Sha256: 4982ae65ce5b73e616d3475f8f024aa5beab4f492a7c11082ffdca1ca460a4d7
Contents?: true
Size: 904 Bytes
Versions: 13
Compression:
Stored size: 904 Bytes
Contents
# frozen_string_literal: true module Decidim # 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 # class MetricManifest include ActiveModel::Model include Decidim::AttributeObject::Model attribute :metric_name, String attribute :manager_class, String validates :metric_name, :manager_class, presence: true def has_settings? settings.attributes.any? end def settings(&block) @settings ||= SettingsManifest.new yield(@settings) if block @settings end # 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 def stat_block settings.attributes[:stat_block].try(:[], :default) || "" end end end
Version data entries
13 entries across 13 versions & 1 rubygems