From: Emmanuel Touzery Date: 2002-12-13T17:53:17+09:00 Subject: Re: ruby namespaces argl.. module Test class Method def initialize() puts "ok" end end Method.new() end seems to fix it. it didn't seem to work in my bigger real program though. i'll check.. sorry for the noise. emmanuel On Friday 13 December 2002 09:51, Emmanuel Touzery wrote: > Hello, > > I looked in the pickaxe book for details about namespaces, there is > mention of modules, but though i'm not sure, I think it's not what I want. > Look at this: > -----------8<----------------- > class Method > def initialize() > puts "ok" > end > end > > Method.new() > ------------------------------- > ruby -w test.rb > test1.rb:7: undefined method `new' for Method:Class (NameError) > -------------------------------- > > If I replace "Method" by "MyMethod", i get as an output "ok". So I conclude > that ruby already provides a class named "Method". I would like to still be > able to have my own class named "Method", either by wrapping the ruby > method in its own namespace, which i would do in C++ say like this: > namespace base { > # include > }; > > either by putting my own class in a namespace (is it enough? if i'm one > "namespace", will my class be preffered to those in the root namespace?). > > does ruby have such facilities? > > thank you, > > emmanuel -- "Stop the world, I want to hop off!" --Guy Bedos