Class: Decidim::MetricManifest

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
decidim-core/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 his managers, for calculations purpose

Direct Known Subclasses

MetricOperationManifest

Instance Method Summary collapse

Instance Method Details

#has_settings?Boolean

Returns:

  • (Boolean)

18
19
20
# File 'decidim-core/lib/decidim/metric_manifest.rb', line 18

def has_settings?
  settings.attributes.any?
end

#settings {|@settings| ... } ⇒ Object

Yields:


22
23
24
25
26
# File 'decidim-core/lib/decidim/metric_manifest.rb', line 22

def settings(&block)
  @settings ||= SettingsManifest.new
  yield(@settings) if block
  @settings
end

#stat_blockObject

stat_block is a non-required parameter This method make it easier to retrieve it,

and gives an empty string if it's not configured

31
32
33
# File 'decidim-core/lib/decidim/metric_manifest.rb', line 31

def stat_block
  settings.attributes[:stat_block].try(:[], :default) || ""
end