[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Basic help about "require"

Raveendran Jazzez

6/14/2009 5:28:00 AM


Hi All,

I have 2 folders.

Folder1 --> folder name "child" --> it contains child1.rb

Folder1 --> folder name "parent" --> it contains parent1.rb

MY NEED"

parent.rb

require '../child/child1'

It is giving error.

I want to require child1.rb in parent1.rb.

Please help to solve this issue.

Thanks
--
Posted via http://www.ruby-....

3 Answers

Raveendran Jazzez

6/14/2009 6:01:00 AM

0

Hi All,

I got a solution but i think its not a proper one.


Solution

Dir[File.join(File.dirname(__FILE__), 'child', "*.rb")].each do |file|
require file
end


Any other solutions ?
--
Posted via http://www.ruby-....

???

6/14/2009 8:56:00 AM

0

[Note: parts of this message were removed to make it a legal post.]

2009/6/14 Raveendran Perumalsamy <jazzezravi@gmail.com>

> Hi All,
>
> I got a solution but i think its not a proper one.
>
>
> Solution
>
> Dir[File.join(File.dirname(__FILE__), 'child', "*.rb")].each do |file|
> require file
> end
>
>
> Any other solutions ?
> --
> Posted via http://www.ruby-....
>
>
At windows platform
you need a complete path of the file

Jiten Bhagat

6/14/2009 9:00:00 AM

0

Hi,
In parent1.rb, try this:

require File.join(File.dirname(__FILE__), '..', 'child', 'child1')

Cheers,
Jits


2009/6/14 =D5=C5=EA=BB=EA=C5 <deathyzhang@gmail.com>

> 2009/6/14 Raveendran Perumalsamy <jazzezravi@gmail.com>
>
> > Hi All,
> >
> > I got a solution but i think its not a proper one.
> >
> >
> > Solution
> >
> > Dir[File.join(File.dirname(__FILE__), 'child', "*.rb")].each do |file|
> > require file
> > end
> >
> >
> > Any other solutions ?
> > --
> > Posted via http://www.ruby-....
> >
> >
> At windows platform
> you need a complete path of the file
>