class NRSER::Stash
Abstract generalization of {ActiveSupport::HashWithIndifferentAccess}. Extends {Hash} and provides simple hooks for handling keys and values on write.
Public Class Methods
new(constructor = {})
click to toggle source
Construction
¶ ↑
Calls superclass method
# File lib/nrser/labs/stash.rb, line 27 def initialize(constructor = {}) if constructor.respond_to?(:to_hash) super() update(constructor) hash = constructor.to_hash self.default = hash.default if hash.default self.default_proc = hash.default_proc if hash.default_proc else super(constructor) end end
Protected Instance Methods
_convert_and_put(key, value)
click to toggle source
A wrapper for {#_raw_put} that converts keys and values first.
@todo
Note sure if I want to keep this yet...
# File lib/nrser/labs/stash.rb, line 84 def _convert_and_put key, value _raw_put convert_key(key), convert_value(value, for: :assignment) end