Module: ReadingStorable::ClassMethods

Defined in:
app/models/concerns/reading_storable.rb

Overview

methods defined here are going to extend the class, not the instance of it

Instance Method Summary collapse

Instance Method Details

#indicator_table_name(_indicator_name) ⇒ Object


99
100
101
# File 'app/models/concerns/reading_storable.rb', line 99

def indicator_table_name(_indicator_name)
  table_name
end

#value_column(indicator_name) ⇒ Object


92
93
94
95
96
97
# File 'app/models/concerns/reading_storable.rb', line 92

def value_column(indicator_name)
  unless indicator = Nomen::Indicator[indicator_name]
    raise ArgumentError, "Expecting an indicator name. Got #{indicator_name.inspect}."
  end
  { measure: :measure_value_value }[indicator.datatype] || "#{indicator.datatype}_value".to_sym
end