Skip to content

Instantly share code, notes, and snippets.

@taf2
Created April 27, 2015 20:56
Show Gist options
  • Save taf2/a01bd2637f86ac204196 to your computer and use it in GitHub Desktop.
Save taf2/a01bd2637f86ac204196 to your computer and use it in GitHub Desktop.
class Bar
def calls
['a','b','c','d'].each do|i|
yield i
end
end
def hello
self.calls do|call|
puts call
end
end
end
Bar.new.hello
def new_calls(&block)
['z','y','x'].each do|i|
yield i
end
end
bar = Bar.new
bar.instance_eval do
def calls(&block)
new_calls(&block)
end
end
bar.hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment