Requiring in a Java-like Import Way

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/zdennis/ruby

Zach

That's actually neat... thanks.

Cheers,
Navin.

ยทยทยท

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/zdennis/ruby

"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/zdennis/ruby

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

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/zdennis/ruby

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