The only difference I’m aware of has to do with constant resolution:
H = “Hi from top level”
module A
H = “Hi from A”
def A.say_hi
puts H
end
end
module B
H = “Hi from B”
end
def B.say_hi
puts H
end
A.say_hi # Hi from A
B.say_hi # Hi from top level
David
–
David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com
Ruby/Rails training, mentoring, consulting, code-review
Latest book: The Well-Grounded Rubyist (The Well-Grounded Rubyist)
September Ruby training in NJ has been POSTPONED. Details to follow.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.