Class: Console::Event::Metric
- Defined in:
- lib/console/event/metric.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #format(output, terminal, verbose) ⇒ Object
-
#initialize(name, value, **tags) ⇒ Metric
constructor
A new instance of Metric.
- #to_h ⇒ Object
Methods inherited from Generic
Constructor Details
#initialize(name, value, **tags) ⇒ Metric
Returns a new instance of Metric.
30 31 32 33 34 |
# File 'lib/console/event/metric.rb', line 30 def initialize(name, value, **) @name = name @value = value @tags = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
36 37 38 |
# File 'lib/console/event/metric.rb', line 36 def name @name end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
38 39 40 |
# File 'lib/console/event/metric.rb', line 38 def @tags end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
37 38 39 |
# File 'lib/console/event/metric.rb', line 37 def value @value end |
Class Method Details
.[](**parameters) ⇒ Object
26 27 28 |
# File 'lib/console/event/metric.rb', line 26 def self.[](**parameters) parameters.map(&self.method(:new)) end |
Instance Method Details
#format(output, terminal, verbose) ⇒ Object
44 45 46 |
# File 'lib/console/event/metric.rb', line 44 def format(output, terminal, verbose) output.puts "#{@name}=#{@value} #{@tags.inspect}" end |
#to_h ⇒ Object
40 41 42 |
# File 'lib/console/event/metric.rb', line 40 def to_h {name: @name, value: @value, tags: @tags} end |