Skip to content

Instantly share code, notes, and snippets.

@flivni
Created October 21, 2020 02:20
Show Gist options
  • Save flivni/2fcb1fd48b4edfcbc1ab24e69f779b65 to your computer and use it in GitHub Desktop.
Save flivni/2fcb1fd48b4edfcbc1ab24e69f779b65 to your computer and use it in GitHub Desktop.
class Foo
def bar
yield
puts 'after yield'
end
end
class ExecuteFoo
def initialize
@foo = Foo.new
end
def execute
@foo.bar do
return 'bar' # this returns early from the bar function skipping the "after yield"
end
end
end
ExecuteFoo.new.execute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment