Skip to content

Instantly share code, notes, and snippets.

@asterite
Last active August 29, 2015 14:15
Show Gist options
  • Save asterite/941be5e649ec4c046fd9 to your computer and use it in GitHub Desktop.
Save asterite/941be5e649ec4c046fd9 to your computer and use it in GitHub Desktop.
abstract class Foo
def foo
@foo + 1
end
end
class Bar < Foo
def initialize
@foo = 1
end
end
class Baz < Foo
def initialize
@foo = 1
end
end
a = [Bar.new, Baz.new]
a.each &.foo
class Foo
def foo
@foo + 1
end
end
class Bar < Foo
def initialize
@foo = 1
end
end
class Baz < Foo
def initialize
@foo = 1
end
end
a = [Bar.new, Baz.new]
a.each &:foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment