class Stat

Attributes

collected_at[R]
instance[R]
name[R]
value[R]

Public Class Methods

new(instance, name) click to toggle source
# File lib/stat.rb, line 6
def initialize(instance, name)
    @instance=instance
    @name=name
    @value=0
end

Public Instance Methods

to_hash() click to toggle source
# 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
value=(newval) click to toggle source
# File lib/stat.rb, line 12
def value=(newval)
    @value=newval.to_i
    @collected_at=Time.now.to_i
end