Class: ReportsKit::Reports::ModelSettings
- Inherits:
-
Object
- Object
- ReportsKit::Reports::ModelSettings
- Defined in:
- lib/reports_kit/reports/model_settings.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#model_configuration_type ⇒ Object
Returns the value of attribute model_configuration_type.
-
#series ⇒ Object
Returns the value of attribute series.
Instance Method Summary collapse
-
#initialize(series, model_configuration_type, key) ⇒ ModelSettings
constructor
A new instance of ModelSettings.
- #model_class ⇒ Object
- #settings_from_model ⇒ Object
Constructor Details
#initialize(series, model_configuration_type, key) ⇒ ModelSettings
Returns a new instance of ModelSettings.
6 7 8 9 10 |
# File 'lib/reports_kit/reports/model_settings.rb', line 6 def initialize(series, model_configuration_type, key) self.series = series self.model_configuration_type = model_configuration_type self.key = key end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
4 5 6 |
# File 'lib/reports_kit/reports/model_settings.rb', line 4 def key @key end |
#model_configuration_type ⇒ Object
Returns the value of attribute model_configuration_type.
4 5 6 |
# File 'lib/reports_kit/reports/model_settings.rb', line 4 def model_configuration_type @model_configuration_type end |
#series ⇒ Object
Returns the value of attribute series.
4 5 6 |
# File 'lib/reports_kit/reports/model_settings.rb', line 4 def series @series end |
Instance Method Details
#model_class ⇒ Object
22 23 24 25 |
# File 'lib/reports_kit/reports/model_settings.rb', line 22 def model_class return unless series series.model_class end |
#settings_from_model ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/reports_kit/reports/model_settings.rb', line 12 def settings_from_model return {} if model_configuration.blank? config_hashes = model_configuration.public_send(model_configuration_type) return {} if config_hashes.blank? config_hash = config_hashes.find do |hash| hash[:key] == key end config_hash || {} end |