Module: Tyrion::Persistence::InstanceMethods
- Defined in:
- lib/tyrion/persistence.rb
Instance Method Summary collapse
Instance Method Details
#delete ⇒ Object
37 38 39 40 |
# File 'lib/tyrion/persistence.rb', line 37 def delete self.class.storage[klass_name].delete_if{ |doc| self == doc } self.class.save_storage(klass_name) end |
#initialize(*args) ⇒ Object
20 21 22 23 |
# File 'lib/tyrion/persistence.rb', line 20 def initialize(*args) super(*args) @persisted = false end |
#persisted? ⇒ Boolean
42 43 44 |
# File 'lib/tyrion/persistence.rb', line 42 def persisted? @persisted end |
#save ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/tyrion/persistence.rb', line 25 def save if valid? self.class.storage[klass_name] << self self.class.save_storage klass_name @persisted = true true else false end end |