Sha256: 4e2824ab4b199d0c266ba4fbfaefd901db483ded6e6fcaac5c9d6a44e787f275
Contents?: true
Size: 515 Bytes
Versions: 6
Compression:
Stored size: 515 Bytes
Contents
unless ([].tally({}) rescue false) require 'backports/tools/arguments' require 'backports/2.7.0/enumerable/tally' require 'backports/tools/alias_method_chain' module Enumerable def tally_with_hash_argument(h = ::Backports::Undefined) return tally_without_hash_argument if h.equal? ::Backports::Undefined h = ::Backports.coerce_to_hash(h) each_entry { |item| h[item] = h.fetch(item, 0) + 1 } h end ::Backports.alias_method_chain self, :tally, :hash_argument end end
Version data entries
6 entries across 6 versions & 1 rubygems