module Nuggets::Hash::IDMapMixin

Public Instance Methods

idmap(counter = 0) { |counter| ... } click to toggle source
# 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