Module: Nuggets::Hash::IDMapMixin
- Included in:
- Hash
- Defined in:
- lib/nuggets/hash/idmap_mixin.rb
Instance Method Summary collapse
Instance Method Details
#idmap(counter = 0) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/nuggets/hash/idmap_mixin.rb', line 31 def idmap(counter = 0) if block_given? new { |hash, key| hash[key] = yield(counter += 1) } else new { |hash, key| hash[key] = counter += 1 } end end |