Mega Code Archive

 
Categories / Ruby / Language Basics
 

Involve demonstrating two classes with the same name, but in different modules

module ToolBox   class Ruler     attr_accessor :length   end end module Country   class Ruler     attr_accessor :name   end end a = ToolBox::Ruler.new a.length = 50 b = Country::Ruler.new b.name = "Ghengis Khan from Moskau"