class Console::Event::Metric

Attributes

name[R]
tags[R]
value[R]

Public Class Methods

[](**parameters) click to toggle source
# File lib/console/event/metric.rb, line 27
def self.[](**parameters)
        parameters.map(&self.method(:new))
end
new(name, value, **tags) click to toggle source
# File lib/console/event/metric.rb, line 31
def initialize(name, value, **tags)
        @name = name
        @value = value
        @tags = tags
end

Public Instance Methods

format(output, terminal, verbose) click to toggle source
# File lib/console/event/metric.rb, line 49
def format(output, terminal, verbose)
        if @tags&.any?
                output.puts "#{value_string} #{@tags.inspect}"
        else
                output.puts value_string
        end
end
to_h() click to toggle source
# File lib/console/event/metric.rb, line 41
def to_h
        {name: @name, value: @value, tags: @tags}
end
value_string() click to toggle source
# File lib/console/event/metric.rb, line 45
def value_string
        "#{@name}: #{@value}"
end