Using external ruby modules in rails


#1

Hello there,

I am fairly new to rails and i was trying to accomplish the following:
There is a gem called ‘scrubyt’ http://scrubyt.org/ (for web scraping)
and i want to use it in my rails application.

I just don’t know what is the best way to use it. Should I make a model
that extends from the module? Or can I somehow use the module directly
in Rails controller.

I guess my problem is that I am not too familiar with ruby modules and
how to extend them in rails.

any help will be highly appreciated!
nsingh


#2

To extend a module in Rails, you purely just call it again.

Lets say you have “module MyModule”, then just write “module MyModel”
in the file which you extend from.

If it’s an already built class and you want to override module
MyModule; class SubClass… Make sure you include the SubClass or it
won’t be overridden.

There should be decent documentation on how to do it on the gem’s
website or atleast elsewhere. Check that out.

Zach I.
→ Blog — http://www.zachinglis.com
→ Company — http://www.lt3media.com
→ Portfolio — http://portfolio.zachinglis.com