Module: Cdss::Concerns::WellReadingAttributes

Included in:
Models::Reading
Defined in:
lib/cdss/concerns/well_reading_attributes.rb

Overview

A concern module that adds well reading-related attributes to classes.

This module provides a comprehensive set of standardized attributes for well reading data, including identification, location, measurement, and publication information. When included in a class, it dynamically adds accessor methods for these attributes.

Examples:

Adding well reading attributes to a class

class WellReading
  include Cdss::Concerns::WellReadingAttributes
end

Constant Summary collapse

WELL_ATTRIBUTES =

Predefined list of well reading attributes

Returns:

  • (Array<Symbol>)

    List of attributes related to well readings

%i[
  well_id
  well_name
  division
  water_district
  county
  management_district
  designated_basin
  publication
  depth_to_water
  measuring_point_above_land_surface
  measurement_date
  depth_water_below_land_surface
  elevation_of_water
  delta
  published
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Dynamically adds accessor methods when the module is included in a class

Parameters:

  • base (Class)

    The class including this module



40
41
42
43
44
# File 'lib/cdss/concerns/well_reading_attributes.rb', line 40

def self.included(base)
  base.class_eval do
    attr_accessor(*WELL_ATTRIBUTES)
  end
end

Instance Method Details

#well_reading?Boolean

Checks if the instance has a valid well reading

Examples:

Check if a well reading is valid

well_reading.well_reading? # => true or false

Returns:

  • (Boolean)

    true if a well ID is present, false otherwise



51
52
53
# File 'lib/cdss/concerns/well_reading_attributes.rb', line 51

def well_reading?
  !well_id.nil?
end