Sha256: ab0c5372978591c0a1ed34f40ea0c09cf04dcd98e4bf5c5ef18a6701f5404848

Contents?: true

Size: 615 Bytes

Versions: 3

Compression:

Stored size: 615 Bytes

Contents

# Records a measurement of a specific value at a specific time
# Once created, measures are immutable

class Measure

  attr_reader :value
  attr_reader :time

  # 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.
  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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mobiusloop-0.1.5 lib/mobiusloop/measure.rb
mobiusloop-0.1.3 lib/mobiusloop/measure.rb
mobiusloop-0.1.2 lib/mobiusloop/measure.rb