Method: Statsample::Codification.inverse_hash

Defined in:
lib/statsample/codification.rb

.inverse_hash(h, sep = Statsample::SPLIT_TOKEN) ⇒ Object


113
114
115
116
117
118
119
120
121
# File 'lib/statsample/codification.rb', line 113

def inverse_hash(h, sep=Statsample::SPLIT_TOKEN)
  h.inject({}) do |a,v|
    v[1].split(sep).each do |val|
      a[val]||=[]
      a[val].push(v[0])
    end
    a
  end
end