Class: MassiveRecord::ORM::RawData
- Inherits:
-
Object
- Object
- MassiveRecord::ORM::RawData
- Defined in:
- lib/massive_record/orm/raw_data.rb
Overview
Class to hold one raw data, and some meta data for that value. As of writing this the meta data is when cell which the data originates from was last written to (created_at).
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(attributes) ⇒ RawData
constructor
A new instance of RawData.
Constructor Details
#initialize(attributes) ⇒ RawData
Returns a new instance of RawData.
28 29 30 31 |
# File 'lib/massive_record/orm/raw_data.rb', line 28 def initialize(attributes) @value = attributes[:value] @created_at = attributes[:created_at] end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/massive_record/orm/raw_data.rb', line 10 def created_at @created_at end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
10 11 12 |
# File 'lib/massive_record/orm/raw_data.rb', line 10 def value @value end |
Class Method Details
.new_with_data_from(object) ⇒ Object
14 15 16 |
# File 'lib/massive_record/orm/raw_data.rb', line 14 def new_with_data_from(object) send("new_with_data_from_#{object.class.to_s.demodulize.underscore}", object) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
36 37 38 39 |
# File 'lib/massive_record/orm/raw_data.rb', line 36 def ==(other) other.equal?(self) || other.instance_of?(self.class) && value == other.value && created_at == other.created_at end |
#hash ⇒ Object
42 43 44 |
# File 'lib/massive_record/orm/raw_data.rb', line 42 def hash [id, created_at].hash end |