Module: Cdss::Concerns::LogReadingAttributes

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

Overview

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

This module provides a set of standardized attributes for log reading data, including aquifer information, depth measurements, elevation, and comments. When included in a class, it dynamically adds accessor methods for these attributes.

Examples:

Adding log reading attributes to a class

class WellLog
  include Cdss::Concerns::LogReadingAttributes
end

Constant Summary collapse

LOG_ATTRIBUTES =

Predefined list of log reading attributes

Returns:

  • (Array<Symbol>)

    List of attributes related to log readings

%i[
  aquifer
  g_log_top_depth
  g_log_base_depth
  g_log_top_elev
  g_log_base_elev
  g_log_thickness
  comment
].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



32
33
34
35
36
# File 'lib/cdss/concerns/log_reading_attributes.rb', line 32

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

Instance Method Details

#log_reading?Boolean

Checks if the instance has log reading data

Examples:

Check if a well log has reading data

well_log.log_reading? # => true or false

Returns:

  • (Boolean)

    true if aquifer or log thickness is present, false otherwise



43
44
45
# File 'lib/cdss/concerns/log_reading_attributes.rb', line 43

def log_reading?
  !aquifer.nil? || !g_log_thickness.nil?
end