Sha256: b8ef6c34f4565673cdc8f793bba0b85d2df2ea567e96a63e1e1e0b9743396d08
Contents?: true
Size: 920 Bytes
Versions: 3
Compression:
Stored size: 920 Bytes
Contents
module Grape module Util class InheritableValues attr_accessor :inherited_values attr_accessor :new_values def initialize(inherited_values = {}) self.inherited_values = inherited_values self.new_values = {} end def [](name) values[name] end def []=(name, value) new_values[name] = value end def delete(key) new_values.delete key end def merge(new_hash) values.merge(new_hash) end def keys (new_values.keys + inherited_values.keys).sort.uniq end def to_hash values.clone end def initialize_copy(other) super self.inherited_values = other.inherited_values self.new_values = other.new_values.deep_dup end protected def values @inherited_values.merge(@new_values) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
grape-0.12.0 | lib/grape/util/inheritable_values.rb |
grape-0.11.0 | lib/grape/util/inheritable_values.rb |
grape-0.10.1 | lib/grape/util/inheritable_values.rb |