Created
January 14, 2015 18:06
-
-
Save brodock/1775ae2e39805723b939 to your computer and use it in GitHub Desktop.
metaprogramming example
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
def x(&block) | |
"alguma coisa".tap &block | |
puts "outra coisa" | |
end | |
x { |obj| puts "METAPROGRAMMING: #{obj.inspect}" } | |
# METAPROGRAMMING: "alguma coisa" | |
# outra coisa | |
# => nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment