Requiring in a Java-like Import Way

Discussion in 'Ruby' started by Zach Dennis, Feb 1, 2005.

  1. Zach Dennis

    Zach Dennis Guest

    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
    Zach Dennis, Feb 1, 2005
    #1
    1. Advertising

  2. Zach Dennis <> 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


    That's actually neat... thanks.

    Cheers,
    Navin.
    Navindra Umanee, Feb 1, 2005
    #2
    1. Advertising

  3. "Zach Dennis" <> schrieb im Newsbeitrag
    news:...
    > 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, Feb 1, 2005
    #3
  4. Zach Dennis

    Zach Dennis Guest

    Robert Klemme wrote:
    >
    > "Zach Dennis" <> schrieb im Newsbeitrag
    > news:...
    >
    >> 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
    Zach Dennis, Feb 1, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Baker
    Replies:
    13
    Views:
    628
    Andrew Baker
    Feb 26, 2004
  2. JPractitioner
    Replies:
    13
    Views:
    20,118
    Roedy Green
    Feb 24, 2006
  3. Patrick Kowalzick
    Replies:
    5
    Views:
    456
    Patrick Kowalzick
    Mar 14, 2006
  4. Andrea Crotti
    Replies:
    0
    Views:
    146
    Andrea Crotti
    Jan 19, 2012
  5. David Teare
    Replies:
    4
    Views:
    90
    William James
    Nov 22, 2005
Loading...

Share This Page