class Cript::EHash
A hash backed by a Cript::Store
object. All methods sent to an instance of this object are wrapped in a transaction and executed immediately.
Constants
- KEY
- METHODS
Public Class Methods
insecure(file, opts = {})
click to toggle source
# File lib/cript/ehash.rb, line 22 def self.insecure(file, opts = {}) new(file, opts.merge({ private_key_content: INSECURE_PRIVATE_KEY })) end
new(file, opts = {})
click to toggle source
# File lib/cript/ehash.rb, line 13 def initialize(file, opts = {}) @store = Store.new(file, opts) @store.transaction do unless @store[KEY].is_a?(Hash) @store[KEY] = {} end end end
Public Instance Methods
inspect()
click to toggle source
# File lib/cript/ehash.rb, line 26 def inspect "#<#{self.class.name} path='#{@store.path}'>" end
method_missing(sym, *args, &block)
click to toggle source
Calls superclass method
# File lib/cript/ehash.rb, line 30 def method_missing(sym, *args, &block) super if !METHODS.include?(sym) || block_given? @store.transaction do @store[KEY].send(sym, *args) end end
respond_to_missing?(sym, include_private = false)
click to toggle source
Calls superclass method
# File lib/cript/ehash.rb, line 38 def respond_to_missing?(sym, include_private = false) METHODS.include?(sym) || super end