Class: Measure
Overview
Records a measurement of a specific value at a specific time Once created, measures are immutable
Instance Attribute Summary collapse
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, time = Time.now) ⇒ Measure
constructor
constructor that records a value and a time that defaults to Time.now unless overridden) constructor that records value at a defined time (instance of Time).
Constructor Details
#initialize(value, time = Time.now) ⇒ Measure
constructor that records a value and a time that defaults to Time.now unless overridden) constructor that records value at a defined time (instance of Time). Only number values allowed.
12 13 14 15 16 17 |
# File 'lib/mobiusloop/measure.rb', line 12 def initialize(value, time = Time.now) raise "Error! Only numbers are allowed for Measure values" unless value.is_a? Numeric raise "Error! Only Time is allowed for Measure time" unless time.is_a? Time @value = value @time = time end |