Class: Stat
- Inherits:
-
Object
- Object
- Stat
- Defined in:
- lib/stat.rb
Instance Attribute Summary collapse
-
#collected_at ⇒ Object
readonly
Returns the value of attribute collected_at.
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(instance, name) ⇒ Stat
constructor
A new instance of Stat.
- #to_hash ⇒ Object
Constructor Details
#initialize(instance, name) ⇒ Stat
Returns a new instance of Stat.
6 7 8 9 10 |
# File 'lib/stat.rb', line 6 def initialize(instance, name) @instance=instance @name=name @value=0 end |
Instance Attribute Details
#collected_at ⇒ Object (readonly)
Returns the value of attribute collected_at.
4 5 6 |
# File 'lib/stat.rb', line 4 def collected_at @collected_at end |
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
4 5 6 |
# File 'lib/stat.rb', line 4 def instance @instance end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/stat.rb', line 4 def name @name end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/stat.rb', line 4 def value @value end |
Instance Method Details
#to_hash ⇒ Object
17 18 19 20 21 |
# File 'lib/stat.rb', line 17 def to_hash hash = {} instance_variables.each {|var| hash[var.to_s.delete("@")] = instance_variable_get(var) } hash end |