class Bug
…..
def Bug.send_bug(msg)
…..
end
end
module A
class B
def initialize
…..
end
end
end
module Bug
def Bug.send_bug(msg)
…..
end
end
…wherever…
Bug.send_bug("Something is amiss")
module Bug
MSG = "Something is amiss"
def Bug.send_bug
p MSG
end
end
Bug::send_bug => "Something is amiss"
Bug.send_bug => "Something is amiss"
p Bug::MSG => "Something is amiss"
p Bug.MSG => undefined method `MSG' for Bug:Module (NoMethodError)
I have asked similar questions on other posts, but i need some refinement
on a concept. In C# you can use "static classes" so that you can write global
functions while maintaining a Namespace structure right?
Ok, i'm learning ruby right now and have been exploring RocketMud which
follows the SocketMud approach. Because SM was written in C it makes sense that
it would have a more "procedural" approach. And I still dont know if it is a good practice to have either: Everything is a Class Object, or you have both, as in global static functions AND store all data in Objects (rooms, players, npcs, items etc)
RocketMud uses both and has a more "traditional" programming approach, not being to strict in OO. Infact it says "it has been modifed to a bit more OO"
The reason i ask is i am ready to move past all this theroetical debate and START PROGRAMMING! so any pointers would be nice.
:grinning: