Class: Instrumental::Command
- Inherits:
-
Struct
- Object
- Struct
- Instrumental::Command
- Defined in:
- lib/instrumental/command_structs.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#count ⇒ Object
Returns the value of attribute count.
-
#metric ⇒ Object
Returns the value of attribute metric.
-
#time ⇒ Object
Returns the value of attribute time.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #+(other_command) ⇒ Object
-
#initialize(command, metric, value, time, count) ⇒ Command
constructor
A new instance of Command.
- #metadata ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(command, metric, value, time, count) ⇒ Command
Returns a new instance of Command.
5 6 7 |
# File 'lib/instrumental/command_structs.rb', line 5 def initialize(command, metric, value, time, count) super(command, metric, value, time.to_i, count.to_i) end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command
4 5 6 |
# File 'lib/instrumental/command_structs.rb', line 4 def command @command end |
#count ⇒ Object
Returns the value of attribute count
4 5 6 |
# File 'lib/instrumental/command_structs.rb', line 4 def count @count end |
#metric ⇒ Object
Returns the value of attribute metric
4 5 6 |
# File 'lib/instrumental/command_structs.rb', line 4 def metric @metric end |
#time ⇒ Object
Returns the value of attribute time
4 5 6 |
# File 'lib/instrumental/command_structs.rb', line 4 def time @time end |
#value ⇒ Object
Returns the value of attribute value
4 5 6 |
# File 'lib/instrumental/command_structs.rb', line 4 def value @value end |
Instance Method Details
#+(other_command) ⇒ Object
17 18 19 20 |
# File 'lib/instrumental/command_structs.rb', line 17 def +(other_command) return self if other_command.nil? Command.new(command, metric, value + other_command.value, time, count + other_command.count) end |
#metadata ⇒ Object
13 14 15 |
# File 'lib/instrumental/command_structs.rb', line 13 def "#{metric}:#{time}".freeze end |
#to_s ⇒ Object
9 10 11 |
# File 'lib/instrumental/command_structs.rb', line 9 def to_s [command, metric, value, time, count].map(&:to_s).join(" ") end |