Created
July 24, 2012 13:21
-
-
Save pigoz/3169881 to your computer and use it in GitHub Desktop.
little idea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mapper = mappy do | |
map :name => :username | |
imap :status => :invalid do |status| | |
status == invalid | |
end | |
end | |
map1 = mapper.new User, Hash | |
map2 = mapper.new Hash, User | |
user = map1.call(:name => "CiccioPasticcio", :status => "invalid") | |
hash = map2.call(User.new(:name => "Sbrodolino", :invalid => true)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment