Skip to content

Instantly share code, notes, and snippets.

@shakthimaan
Created March 21, 2014 10:55
Show Gist options
  • Save shakthimaan/9683735 to your computer and use it in GitHub Desktop.
Save shakthimaan/9683735 to your computer and use it in GitHub Desktop.
How to invoke Test.hello() from class Alpha/Beta?
module Hello
class Test
attr_accessor :registers
def initialize()
@registers = []
@registers << Alpha.new
@registers << Beta.new
end
def display
p @registers
end
def hello()
p "Hello"
end
end
class Alpha
def initialize()
@registers = "Alpha"
# How to call Test.hello() from here?
end
end
class Beta
def initialize()
@registers = "Beta"
end
end
end
h = Hello::Test.new()
h.display()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment