Class: Nuggets::JSON::MultiMixin::MULTI_OBJECT
- Inherits:
-
Hash
- Object
- Hash
- Nuggets::JSON::MultiMixin::MULTI_OBJECT
show all
- Defined in:
- lib/nuggets/json/multi_mixin.rb
Instance Method Summary
collapse
Methods inherited from Hash
#at, #first, #in_order, #insert, #insert!, #last, #only, #only_pair, #rand
#zip, #zipkey, #zipval
#array, #identity, #nest
#seen
#idmap
#deep_merge, #deep_merge!
#deep_fetch
#vain?
#unroll
#deproc, #deproc!
Instance Method Details
#[]=(k, v) ⇒ Object
47
48
49
|
# File 'lib/nuggets/json/multi_mixin.rb', line 47
def []=(k, v)
super(MULTI_KEY.new(k), v)
end
|
#each_multi(k) ⇒ Object
51
52
53
|
# File 'lib/nuggets/json/multi_mixin.rb', line 51
def each_multi(k)
block_given? ? each { |l, v| yield v if k == l } : enum_for(__method__, k)
end
|
#fetch_multi(k) ⇒ Object
55
56
57
|
# File 'lib/nuggets/json/multi_mixin.rb', line 55
def fetch_multi(k)
each_multi(k).to_a
end
|