D
Dema
Hi guys,
This question is better explained with an example:
I have the standard File class, right? Suppose I define another File
class within my own namespace:
module MyNamespace
class File
...
end
end
Now, if I am on an irb session and I want to refer to my
MyNamespace::File class using only the short form 'File', I would do:
include MyNamespace
How does Ruby decide which class to use when I reference 'File' in this
scope? (I've already tested and the original 'File' class is the chosen
class)
How would I be able to temporarely replace the standard 'File' class in
the global Object namespace with my own File class and then revert it
back to the standard when I'm done?
rgds
Dema
http://dema.ruby.com.br
This question is better explained with an example:
I have the standard File class, right? Suppose I define another File
class within my own namespace:
module MyNamespace
class File
...
end
end
Now, if I am on an irb session and I want to refer to my
MyNamespace::File class using only the short form 'File', I would do:
include MyNamespace
How does Ruby decide which class to use when I reference 'File' in this
scope? (I've already tested and the original 'File' class is the chosen
class)
How would I be able to temporarely replace the standard 'File' class in
the global Object namespace with my own File class and then revert it
back to the standard when I'm done?
rgds
Dema
http://dema.ruby.com.br