Created
February 24, 2013 20:34
-
-
Save joonyou/5025499 to your computer and use it in GitHub Desktop.
Ruby 2.0 – Getting Started & Named Parameters
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 foo(with:"default", delegate:String, selector:"to_s") | |
puts "with: #{with}" | |
puts "delegate: #{delegate.class.to_s}" | |
puts "result: #{delegate.send(selector)}" | |
end | |
def bar; puts "hello from Bar";end | |
foo with:"Joon", delegate:self, selector:"bar" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi.
The line
def bar; puts "hello from Bar";end
contains aputs
which sends the output to the console, not to the caller method.Thats why it doesn't work as it should.