Module: Vault::Persistance
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/vault/persistance.rb
Defined Under Namespace
Modules: Storage
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
35 36 37 38 39 |
# File 'lib/vault/persistance.rb', line 35 def destroy self.class.store.delete(key) @_destroyed = true freeze end |
#initialize ⇒ Object
18 19 20 21 22 |
# File 'lib/vault/persistance.rb', line 18 def initialize(*) @_new = true @_destroyed = false super end |
#persisted? ⇒ Boolean
24 25 26 |
# File 'lib/vault/persistance.rb', line 24 def persisted? !@_new && !@_destroyed end |
#save(run_validations = true) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/vault/persistance.rb', line 28 def save(run_validations=true) return false if run_validations && !valid? self.class.store[key] = attributes_except_key @_new = false true end |