module Nuggets::Hash::IDMapMixin

Public Instance Methods

idmap(counter = 0) { |counter| ... } click to toggle source
   # File lib/nuggets/hash/idmap_mixin.rb
31 def idmap(counter = 0)
32   if block_given?
33     new { |hash, key| hash[key] = yield(counter += 1) }
34   else
35     new { |hash, key| hash[key] = counter += 1 }
36   end
37 end