Best way to handle namespace collisions?

All,

I have a little namespace collision here. I am trying to use both
RubyfulSoup (an HTML parser - which I highly recommend by the way) and
the ActionView::Helpers::TextHelper class. Within the TextHelper class,
there’s an attempt to create a new “Tag” object. However, Tag is also
defined in the RubyfulSoup gem and it is this Tag class whose
initialize method is being called (and failing of course).

So, is my choice simply which Gem to hack and fully qualify the class
name more?

Or is there a way to force one of the modules to look for the class
definition within itself instead of in the path (I doubt it but I
thought I would ask)?

Any other advice?

Thanks,
Wes

I don’t know a solution either, but if Ruby does not have a namespace
solution I think it will be a major stumbling block.

I hit a name collision last week with active_rbac and tracks. Both
use a table “user”, and I had an instance variable named “@user” that
also collided with tracks.

What surprised me the most is that active_rbac actually has its MVC
setup in a active_rbac subdirectory to avoid some collisions, but the
user helper apparently had to live at the base of the helpers
directory.

The more popular engines etc. get, the more this issue is going to bite
people.

Greg

On 5/16/06, Wes G. [email protected] wrote:

name more?

Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Greg F.
The Norcross Group
Forensics for the 21st Century

I’m also using Rubyful Soup to do some parsing and my own Tag model is
colliding with Soup’s Tag. Still haven’t found a good solution yet
either.

Justin

Justin C. wrote:

I’m also using Rubyful Soup to do some parsing and my own Tag model is
colliding with Soup’s Tag. Still haven’t found a good solution yet
either.

Justin

Well, at least you can control your namespace. I had to make a local
copy of Rubyful Soup to only include only part of one of the gems that
it depends on.

Good luck.

Wes