i don't understand sheep = class.new part in following piece of code.
module fence sheep = class.new def speak "bah." end end end def call_sheep fence::sheep.new.speak end what doing?
according documentation, class.new
creates new anonymous (unnamed) class given superclass (or
objectif no parameter given).
furthermore,
you can give class name assigning class object constant.
sheep constant, code equivalent to:
module fence class sheep def speak "bah." end end end
Comments
Post a Comment