Created
August 25, 2012 13:50
-
-
Save atton/3466002 to your computer and use it in GitHub Desktop.
メソッドへの {} 渡し
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
# method { ... } だと | |
# ブロックを渡してるのかハッシュを渡してるのか、ってなるので | |
# ハッシュを渡したい時は {} を省略して良いらしい | |
def puts_hash_hoge hash | |
puts hash[:hoge] | |
end | |
puts_hash_hoge :hoge => "hogehoge" , :fuga => "fugafuga" | |
# puts_hash_hoge {:hoge => "hogehoge" , :fuga => "fugafuga" } | |
# だと怒られる |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
これはOK