Sha256: e5c5258fe410691ed21b301a468703453f17460a76786b92aaee1edc78939d6b
Contents?: true
Size: 440 Bytes
Versions: 1
Compression:
Stored size: 440 Bytes
Contents
require 'set' module Crosscounter module Util extend self def hashify(hash) stringify(hash).inject({}) do |memo, key| memo[key] = 0 memo end end def stringify(hash, sep = '|') hash.flat_map do |key, value| if value.kind_of?(Enumerable) value.map { |elem| "#{key}#{sep}#{elem}" } else ["#{key}#{sep}#{value}"] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
crosscounter-0.4.0 | lib/crosscounter/util.rb |