How do I add a module to a ruby mine project ?

TIMFOX123
TIMFOX123 used Ask the Experts™
on
I have rubymine ide and have read some good things about modules.  I want to put all my reuseable code in a module and use that as a basis for all my code, forever and ever.

The gui does not have a "file /new /module".

If I put it in a project, how do I find it for later projects ?  Should i put in a symlink ?

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
My teacher has a great page for our scripting class. This section is about modules and it should be helpful. http://userpages.umbc.edu/~dhood2/courses/cmsc433/spring2010/?section=Notes&topic=Ruby¬es=10
Commented:
Here are some links that show how to extract a module from existing code in RubyMind:

http://www.jetbrains.com/ruby/webhelp/refactoring-source-code.html
http://www.jetbrains.com/ruby/webhelp/extract-module.html
http://www.jetbrains.com/ruby/webhelp/extract-module-dialog.html

Much of the code I've seen puts modules into a separate 'lib' directory inside your project. If you want to use the module from several projects, you'll have to put it into a separate library and then make that library available to Ruby in the project that uses it (gems do that by dropping their code into a subdirectory that ruby already knows about and then initializing themselves).

Take a look at http://blog.bogojoker.com/category/rr/ for how gems are structured / created for some insight into this.

Author

Commented:
Jesii - great job, by the way I have paid for my ide, wating for lic.    

Mhamel - thanks for the class, will be using it.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial