Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement