require 'Mycompany/Net/Pop'
headers = Mycompany::Net::Pop::Command.top()
It is easier to use just
require 'Mycompany/Net/Pop'
headers = Command.top()
I would recommend:
require 'Mycompany/Net/Pop' include Mycompany::Net::Pop
Then Command will be part of the current namespace.
-- David Black
Not Really. Conflicts can be handled by using fully qualified name. Anyway how can using include help this.
-- rolo [Rohit Lodha]
Consider this:
require 'A/B/C' require 'D/E/C'What is C.new at this point? And does it change, depending on the order? Or depending on whether you rewrite the code and remove something?
As for include... what it does is eliminate the need to use the fully-qualified path. That was your goal, wasn't it? :-)
-- David Black
I would recommend:
require 'Mycompany/Net/Pop' include Mycompany::Net::Pop
Then Command will be part of the current namespace.
-- David Black
Not Really. Conflicts can be handled by using fully qualified name. Anyway how can using include help this.
-- rolo [Rohit Lodha]
Consider this:
require 'A/B/C' require 'D/E/C'What is C.new at this point? And does it change, depending on the order? Or depending on whether you rewrite the code and remove something?
As for include... what it does is eliminate the need to use the fully-qualified path. That was your goal, wasn't it? :-)
-- David Black
require 'Mycompany/Net/Pop' cmd = Mycompany::Net::Pop::Commands headers = cmd.top
This way, you can even have David's example:
require 'A/B/C' require 'D/E/C'
abc = A::B::C dec = D::E::C
-austin
Back to RCRchive.
RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog