Class: Fabricio::Model::Point
- Inherits:
-
Object
- Object
- Fabricio::Model::Point
- Defined in:
- lib/fabricio/models/point.rb
Overview
This model represents a data point with two fields - timestamp and value
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Fabricio::Model::Point
constructor
Returns a data point with two fields - timestamp and value.
Constructor Details
#initialize(attributes) ⇒ Fabricio::Model::Point
Returns a data point with two fields - timestamp and value
11 12 13 14 |
# File 'lib/fabricio/models/point.rb', line 11 def initialize(attributes) @date = DateTime.strptime(attributes.first.to_s,'%s') @value = attributes.last end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
5 6 7 |
# File 'lib/fabricio/models/point.rb', line 5 def date @date end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/fabricio/models/point.rb', line 5 def value @value end |