Class: LogSnag::Insight
Overview
Constructs and validates an “insight” object
Constant Summary collapse
- REQUIRED_KEYS =
%i[project title value].freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(data, config, mutate: false) ⇒ LogSnag::Insight
constructor
Creates a new Insight object.
Methods inherited from EventBase
Constructor Details
#initialize(data, config, mutate: false) ⇒ LogSnag::Insight
Creates a new Insight object. The data hash MUST include the following keys:
- :title [String] The title of the insight.
- :value [String,Numeric] The numerical value of the insight.
The data hash MAY include the following keys:
- :icon [String] The icon to be displayed with the insight.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/logsnag/insight.rb', line 25 def initialize(data, config, mutate: false) super(data, config) append_required_fields! if mutate validate_mutation_data else validate_data end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/logsnag/insight.rb', line 11 def config @config end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/logsnag/insight.rb', line 11 def data @data end |