[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Requiring in a Java-like Import Way

Zach Dennis

2/1/2005 7:19:00 PM

Since Navindra wanted to know how-to handle java-like imports I've
blogged my solution which allows:

require 'mypackage.subpackage.file'
require 'mypackage.*'

to be used. So check it out if this you're interested...

http://blog.mktec.com/zd...

Zach



3 Answers

Navindra Umanee

2/1/2005 9:15:00 PM

0

Zach Dennis <zdennis@mktec.com> wrote:
> Since Navindra wanted to know how-to handle java-like imports I've
> blogged my solution which allows:
>
> require 'mypackage.subpackage.file'
> require 'mypackage.*'
>
> to be used. So check it out if this you're interested...
>
> http://blog.mktec.com/zd...

That's actually neat... thanks.

Cheers,
Navin.



Robert Klemme

2/1/2005 11:25:00 PM

0


"Zach Dennis" <zdennis@mktec.com> schrieb im Newsbeitrag
news:41FFD612.4020901@mktec.com...
> Since Navindra wanted to know how-to handle java-like imports I've blogged
> my solution which allows:
>
> require 'mypackage.subpackage.file'
> require 'mypackage.*'
>
> to be used. So check it out if this you're interested...
>
> http://blog.mktec.com/zd...

some remarks: I'd change "what.gsub!( /\./, '/' )" into "what = what.gsub(
/\./, '/' )" in order to not fiddle with the argument (could be frozen after
all). Is it possible that your regexp should've read "if( what =~
/^(.*)\.\*$/ )" (main issue the missing "\.")?

Kind regards

robert

Zach Dennis

2/1/2005 11:45:00 PM

0

Robert Klemme wrote:
>
> "Zach Dennis" <zdennis@mktec.com> schrieb im Newsbeitrag
> news:41FFD612.4020901@mktec.com...
>
>> Since Navindra wanted to know how-to handle java-like imports I've
>> blogged my solution which allows:
>>
>> require 'mypackage.subpackage.file'
>> require 'mypackage.*'
>>
>> to be used. So check it out if this you're interested...
>>
>> http://blog.mktec.com/zd...
>
>
> some remarks: I'd change "what.gsub!( /\./, '/' )" into "what =
> what.gsub( /\./, '/' )" in order to not fiddle with the argument (could
> be frozen after all).

Ah...yes. thx

> Is it possible that your regexp should've read
> "if( what =~ /^(.*)\.\*$/ )" (main issue the missing "\.")?

its possible for someone to name a file "file*" but that is poor naming,
but entirely possible! I'll make the update for the "\." to be. thx for
pointing this out.

Zach