Class: Decidim::MetricManifest
- Inherits:
-
Object
- Object
- Decidim::MetricManifest
- Includes:
- ActiveModel::Model, AttributeObject::Model
- Defined in:
- lib/decidim/metric_manifest.rb
Overview
This class acts as a manifest for metrics.
This manifest is a simple object that holds and stores currently available metrics and its managers, for calculations purpose
Direct Known Subclasses
Constant Summary
Constants included from AttributeObject::TypeMap
AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal
Instance Method Summary collapse
- #has_settings? ⇒ Boolean
- #settings {|@settings| ... } ⇒ Object
-
#stat_block ⇒ Object
stat_block is a non-required parameter This method make it easier to retrieve it, and gives an empty string if it is not configured.
Methods included from AttributeObject::Model
#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h
Instance Method Details
#has_settings? ⇒ Boolean
18 19 20 |
# File 'lib/decidim/metric_manifest.rb', line 18 def has_settings? settings.attributes.any? end |
#settings {|@settings| ... } ⇒ Object
22 23 24 25 26 |
# File 'lib/decidim/metric_manifest.rb', line 22 def settings(&block) @settings ||= SettingsManifest.new yield(@settings) if block @settings end |
#stat_block ⇒ Object
stat_block is a non-required parameter This method make it easier to retrieve it,
and gives an empty string if it is not configured
31 32 33 |
# File 'lib/decidim/metric_manifest.rb', line 31 def stat_block settings.attributes[:stat_block].try(:[], :default) || "" end |