I'm trying to write a simple module/class, in it i'm trying to capture
the repetitive, that i can reuse to make my life easier.
How do i setup this module, so i can make refernces to it?
Where do i need to store the actual file?
I would like to know how can i make references to this module?
if somebody can point me to the right direction, that'll be very helpul.
appreciate the help.
Parvinder
I'm trying to write a simple module/class, in it i'm trying to capture the repetitive, that i can reuse to make my life easier.
How do i setup this module, so i can make refernces to it?
Where do i need to store the actual file?
I would like to know how can i make references to this module?
if somebody can point me to the right direction, that'll be very helpul.
appreciate the help.
Parvinder
Hi, I'm not sure I 100% understand what you want, but here goes:
You generally set up a class in a stand-alone rb-file. ("class MyClass; ..; end" in myclass.rb, e.g.)
Then, you either put it in one of the system library dirs, or below the dir that your project is stored in.
Inside your program, you have a line like "require 'myclass'", then use it like any other class.
.. Is this what you're asking, did it answer your question?
···
--
Kindest regards / Med vennlig hilsen,
Jørgen P. Tjernø
<jorgen@devsoft.no>
I'm trying to write a simple module/class, in it i'm trying to capture
the repetitive, that i can reuse to make my life easier.
How do i setup this module, so i can make refernces to it?
Where do i need to store the actual file?
I would like to know how can i make references to this module?
if somebody can point me to the right direction, that'll be very helpul.
appreciate the help.
Parvinder
Well, you can store a module/class in with the rest of your code or as
a separate file and use #require to bring it into your program.
Generally these files are installed in a subdir of Ruby site_ruby
location. For instance, if you are using Debian linux: