How can I use a specific directory as the lib along with ruby library
files???
can Any one reply me with class name or module name?
···
--
Posted via http://www.ruby-forum.com/.
How can I use a specific directory as the lib along with ruby library
files???
can Any one reply me with class name or module name?
--
Posted via http://www.ruby-forum.com/.
If you'd like to include a directory into the path ruby searches for
files you can use the -I command line prompt. So to add a directory
called 'lib' you'd write
ruby -Ilib program.rb
Farrel
On 15/03/07, Purandhar sairam Mannidi <sai438@gmail.com> wrote:
How can I use a specific directory as the lib along with ruby library
files???
can Any one reply me with class name or module name?--
Posted via http://www.ruby-forum.com/\.
To automatically require all files in a directory?
Some variation of the following might do the trick...
Dir.glob('./directory/*').each do |lib|
require lib
end
Hope that helps.
Mully
On Mar 15, 7:37 am, Purandhar sairam Mannidi <sai...@gmail.com> wrote:
How can I use a specific directory as the lib along with ruby library
files???
can Any one reply me with class name or module name?--
Posted viahttp://www.ruby-forum.com/.
Farrel Lifson wrote:
On 15/03/07, Purandhar sairam Mannidi <sai438@gmail.com> wrote:
How can I use a specific directory as the lib along with ruby library
files???
can Any one reply me with class name or module name?--
Posted via http://www.ruby-forum.com/\.If you'd like to include a directory into the path ruby searches for
files you can use the -I command line prompt. So to add a directory
called 'lib' you'd write
ruby -Ilib program.rbFarrel
Is there any way that we include in the script itself? like in "use
FindBin qw{$RealBin}; use lib $RealBin;" which will find the present
working directory and will include that in @ISA list.
Sairam
--
Posted via http://www.ruby-forum.com/\.
Alle giovedì 15 marzo 2007, Farrel Lifson ha scritto:
> How can I use a specific directory as the lib along with ruby library
> files???
> can Any one reply me with class name or module name?
>
> --
> Posted via http://www.ruby-forum.com/\.If you'd like to include a directory into the path ruby searches for
files you can use the -I command line prompt. So to add a directory
called 'lib' you'd write
ruby -Ilib program.rbFarrel
Or you can manipulate the $: variable from within ruby. It's an array which
contains the paths ruby uses when looking for required files. So, if you do
$: << 'my_lib'
you can require a file contained in the directory my_lib with
require 'my_file'
instead of using
require 'my_lib/my_file'
I hope this helps
Stefano
On 15/03/07, Purandhar sairam Mannidi <sai438@gmail.com> wrote:
Stefano Crocco wrote:
$: << 'my_lib'
I prefere
$:.unshift 'my_lib'
because this way the path 'my_lib' is prepended to the array and you can
be sure the file in this directory will be found even if another with
the same name exist somewhere else in the search path.
regards
Jan
--
Posted via http://www.ruby-forum.com/\.
Stefano Crocco wrote:
Or you can manipulate the $: variable from within ruby. It's an array
which
contains the paths ruby uses when looking for required files. So, if you
do$: << 'my_lib'
you can require a file contained in the directory my_lib with
require 'my_file'
instead of using
require 'my_lib/my_file'
I hope this helps
Stefano
Thanks for the Help
--
Posted via http://www.ruby-forum.com/\.