From: ts Date: 2002-11-04T20:45:29+09:00 Subject: Re: Namespace hygenie >>>>> "M" == Michael Schuerig writes: M> I'm not sure if I understand it correctly, but I don't think it can do M> what I want. Here's an exemplary case Well, I don't know if it will be fast pigeon% cat myexts.rb module MyExts def starts_with(s) index(s) == 0 end def ends_with(s) index(s, -(s.length)) != nil end def without_prefix(p) return self unless self.starts_with(p) self[p.length..-1] end end pigeon% pigeon% cat somelib.rb require 'import-module' require 'myexts' module SomeLib def some_method(s) s.import(MyExts) {|x| p x.without_prefix("abc")} end end pigeon% pigeon% cat b.rb #!/usr/bin/ruby require 'somelib' class C include SomeLib def tt some_method("def") p "abc".without_prefix("def") end end C.new.tt pigeon% pigeon% b.rb "def" ./b.rb:8:in `tt': undefined method `without_prefix' for "abc":String (NameError) from ./b.rb:12 pigeon% Guy Decoux