-
-
Save anonymous/b7ead5891d9a7f834bd3ce7b165ff2a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
def initialize(owner) | |
@owner = owner | |
end | |
def owner_name | |
@owner.class.name.split("::").last | |
end | |
def do_stuff | |
puts owner_name | |
end | |
end | |
class B | |
def initialize | |
@a = A.new(self) | |
end | |
def do_stuff | |
@a.do_stuff | |
end | |
end | |
b = B.new | |
b.do_stuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment