Class: ExtraLoop::Storage::Record
- Inherits:
-
Ohm::Model
- Object
- Ohm::Model
- ExtraLoop::Storage::Record
- Includes:
- Ohm::Boundaries, Ohm::Callbacks, Ohm::Timestamping, Ohm::Typecast
- Defined in:
- lib/extraloop/redis-storage/record.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Record
constructor
A new instance of Record.
- #to_hash ⇒ Object
- #to_yaml ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Record
Returns a new instance of Record.
11 12 13 14 |
# File 'lib/extraloop/redis-storage/record.rb', line 11 def initialize attrs={} self.class.send(:_inherit!) super attrs end |
Class Method Details
.create(attrs = {}) ⇒ Object
16 17 18 19 |
# File 'lib/extraloop/redis-storage/record.rb', line 16 def self.create attrs={} _inherit! super attrs end |
Instance Method Details
#to_hash ⇒ Object
21 22 23 24 25 |
# File 'lib/extraloop/redis-storage/record.rb', line 21 def to_hash super.merge(attributes.reduce({}) { |memo, attribute| memo.merge(attribute => send(attribute)) }) end |
#to_yaml ⇒ Object
27 28 29 |
# File 'lib/extraloop/redis-storage/record.rb', line 27 def to_yaml to_hash.to_yaml end |
#validate ⇒ Object
31 32 33 |
# File 'lib/extraloop/redis-storage/record.rb', line 31 def validate assert_present :session end |