Skip to content

Instantly share code, notes, and snippets.

@havenwood
Last active November 30, 2019 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save havenwood/36ec67eed5902ae70fa24d10c7a6368e to your computer and use it in GitHub Desktop.
Save havenwood/36ec67eed5902ae70fa24d10c7a6368e to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
class Hello
attr_reader :foo, :bar
def initialize
@foo = Foo.new(self)
@bar = Bar.new(self)
@foo.hello
@bar.hello
end
end
class Foo
def initialize(hello)
@hello = hello
end
def hello
p @hello
end
end
class Bar
def initialize(hello)
@hello = hello
end
def hello
p @hello
end
end
Hello.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment