Skip to content

Instantly share code, notes, and snippets.

@harukizaemon
Created May 14, 2010 00:28
Show Gist options
  • Select an option

  • Save harukizaemon/400667 to your computer and use it in GitHub Desktop.

Select an option

Save harukizaemon/400667 to your computer and use it in GitHub Desktop.
class Foo
def to_ary
["A", "B", "C", "D"]
end
end
def func(&block)
yield(Foo.new)
end
func do |a, b, *c|
puts a.inspect # MRI => "A" RBX => <#Foo>
puts b.inspect # MRI => "B" RBX => nil
puts c.inspect # MRI => ["C", "D"] RBX => []
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment