Skip to content

Releases: pote/hashifiable

Accepting Strings as hash keys

13 Dec 17:46
Compare
Choose a tag to compare

Thanks to @zspackett triggering the need for this feature hashifiable now supports using Strings as keys for the hash representation of your objects!

class TestUser < Struct.new(:id, :name, :credit_card, :secret_token, :quote)
  extend Hashifiable
  hashify :id,
          :name,
          'quote',
          'random' => Proc.new { [1, 2, 3].sample },
end

Thanks to @foca and @inkel for input on this feature!