Class: Timeseries::DataPoint

Inherits:
Object
  • Object
show all
Defined in:
lib/timeseries/data_point.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date = DateTime.new, value = 0) ⇒ DataPoint

Returns a new instance of DataPoint.

Raises:

  • (ArgumentError)


5
6
7
8
9
# File 'lib/timeseries/data_point.rb', line 5

def initialize date = DateTime.new , value = 0
	raise ArgumentError , "Must use ruby DateTime format for DataPoint dates" unless date.class == DateTime
	@date = date
	@value = value
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



3
4
5
# File 'lib/timeseries/data_point.rb', line 3

def date
  @date
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/timeseries/data_point.rb', line 3

def value
  @value
end