Sha256: ce79c0874a00b9fb704cf05ed12a10893b5a0b803233f2feb01436c038b9ee46

Contents?: true

Size: 285 Bytes

Versions: 2

Compression:

Stored size: 285 Bytes

Contents

module Id::Hashifier
  extend self

  def enhash(value)
    case value
    when Hash
      value.reduce({}) { |acc, (k, v)| acc.merge(k.to_s => enhash(v)) }
    when Array
      value.map { |v| enhash(v) }
    when Id::Model
      value.to_hash
    else
      value
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
id-0.1.1 lib/id/hashifier.rb
id-0.1 lib/id/hashifier.rb