Skip to content

Instantly share code, notes, and snippets.

@graingert
Last active October 14, 2015 17:26
Show Gist options
  • Save graingert/269b72e119428e53b8b3 to your computer and use it in GitHub Desktop.
Save graingert/269b72e119428e53b8b3 to your computer and use it in GitHub Desktop.
class Foo
def handle(obj)
yield obj
end
end
class Bar < Foo
def handle(obj)
super { | a | yield a.downcase }
end
end
Foo.new.handle('HELLO'){ | a | puts a; } # HELLO
Bar.new.handle('HELLO'){ | b | puts b; } # expects hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment