ask ri for the other squeeze

Discussion in 'Ruby' started by matt neuburg, Feb 21, 2009.

  1. matt neuburg

    matt neuburg Guest

    First off, may I say that ri, with its recent improvements, is now
    useful to me for the first time since I started using ruby? With the
    spaces after the commas, the listing of a class's superclass, the
    ability to search up the class hierarchy, and so forth, I can now
    usually find what I'm looking for and read the result.

    That said, there remain a few edge cases on my machine where ri seems to
    break down. An example is String#squeeze, which comes up with an empty
    description:

    --------------------------------------------------------- String#squeeze
    squeeze(del=nil)

    From /usr/local/share/ri/1.8/site/String/cdesc-String.yaml
    ------------------------------------------------------------------------
    [no description]

    There is, however, another String#squeeze that *does* have a
    description. Where there's a choice like this, I'd like to see the one
    with the description. I can say:

    $ ri --no-site String#squeeze

    and that does work, but it also causes a huge delay both now while the
    cache is rebuilt and on the next ri search without --no-site while the
    cache is rebuilt *again*. What I'd really like is syntax for choosing
    between different String#squeeze. For example, maybe the -i interactive
    option could give me the ability to enter numbers?

    m.

    --
    matt neuburg, phd = , http://www.tidbits.com/matt/
    Leopard - http://www.takecontrolbooks.com/leopard-customizing.html
    AppleScript - http://www.amazon.com/gp/product/0596102119
    Read TidBITS! It's free and smart. http://www.tidbits.com
     
    matt neuburg, Feb 21, 2009
    #1
    1. Advertising

  2. matt neuburg

    badboy Guest

    matt neuburg schrieb:
    > First off, may I say that ri, with its recent improvements, is now
    > useful to me for the first time since I started using ruby? With the
    > spaces after the commas, the listing of a class's superclass, the
    > ability to search up the class hierarchy, and so forth, I can now
    > usually find what I'm looking for and read the result.
    >
    > That said, there remain a few edge cases on my machine where ri seems to
    > break down. An example is String#squeeze, which comes up with an empty
    > description:
    >
    > --------------------------------------------------------- String#squeeze
    > squeeze(del=nil)
    >
    > From /usr/local/share/ri/1.8/site/String/cdesc-String.yaml
    > ------------------------------------------------------------------------
    > [no description]
    >
    > There is, however, another String#squeeze that *does* have a
    > description. Where there's a choice like this, I'd like to see the one
    > with the description. I can say:
    >
    > $ ri --no-site String#squeeze
    >
    > and that does work, but it also causes a huge delay both now while the
    > cache is rebuilt and on the next ri search without --no-site while the
    > cache is rebuilt *again*. What I'd really like is syntax for choosing
    > between different String#squeeze. For example, maybe the -i interactive
    > option could give me the ability to enter numbers?
    >
    > m.
    >

    hm...I have no problems with String#squeeze
    not for ruby 1.8.7 nor for 1.9.1

    but I prefer fastri over ri, because....it's *faster* =D
    http://eigenclass.org/hiki/fastri
     
    badboy, Feb 21, 2009
    #2
    1. Advertising

  3. matt neuburg

    Roger Pack Guest


    > but I prefer fastri over ri, because....it's *faster* =D
    > http://eigenclass.org/hiki/fastri


    Note also that you can lookup things in irb

    irb(main):002:0> help "String#chars"
    ----------------------------------------------------------- String#chars
    str.chars => anEnumerator
    str.chars {|substr| block } => str
    ------------------------------------------------------------------------
    Returns an enumerator that gives each character in the string. If a
    block is given, it iterates over each character in the string.

    "foo".chars.to_a #=> ["f","o","o"]


    => nil
    irb(main):003:0>

    --
    Posted via http://www.ruby-forum.com/.
     
    Roger Pack, Feb 21, 2009
    #3
  4. matt neuburg

    matt neuburg Guest

    badboy <> wrote:

    > matt neuburg schrieb:
    > > First off, may I say that ri, with its recent improvements, is now
    > > useful to me for the first time since I started using ruby? With the
    > > spaces after the commas, the listing of a class's superclass, the
    > > ability to search up the class hierarchy, and so forth, I can now
    > > usually find what I'm looking for and read the result.
    > >
    > > That said, there remain a few edge cases on my machine where ri seems to
    > > break down. An example is String#squeeze, which comes up with an empty
    > > description:
    > >
    > > --------------------------------------------------------- String#squeeze
    > > squeeze(del=nil)
    > >
    > > From /usr/local/share/ri/1.8/site/String/cdesc-String.yaml
    > > ------------------------------------------------------------------------
    > > [no description]
    > >
    > > There is, however, another String#squeeze that *does* have a
    > > description. Where there's a choice like this, I'd like to see the one
    > > with the description. I can say:
    > >
    > > $ ri --no-site String#squeeze
    > >
    > > and that does work, but it also causes a huge delay both now while the
    > > cache is rebuilt and on the next ri search without --no-site while the
    > > cache is rebuilt *again*. What I'd really like is syntax for choosing
    > > between different String#squeeze. For example, maybe the -i interactive
    > > option could give me the ability to enter numbers?
    > >
    > > m.
    > >

    > hm...I have no problems with String#squeeze
    > not for ruby 1.8.7 nor for 1.9.1
    >
    > but I prefer fastri over ri, because....it's *faster*


    Faster, but long ago broken OMM. It stopped working one day (after a
    rdoc update, I think) and just never worked again. It doesn't look very
    supported and I assume it is no longer maintained...?

    I am still back at 1.8.6.

    $ qri String
    /usr/local/lib/ruby/1.8/yaml.rb:133:in `transfer': invalid subclass
    (TypeError)
    from /usr/local/lib/ruby/1.8/yaml.rb:133:in `node_import'
    from /usr/local/lib/ruby/1.8/yaml.rb:133:in `load'
    from /usr/local/lib/ruby/1.8/yaml.rb:133:in `load'
    from /usr/local/lib/ruby/1.8/rdoc/ri/ri_descriptions.rb:72:in
    `deserialize'
    from /usr/local/lib/ruby/site_ruby/1.8/fastri/ri_index.rb:354:in
    `get_class'
    from /usr/local/lib/ruby/site_ruby/1.8/fastri/ri_index.rb:354:in
    `open'
    from /usr/local/lib/ruby/site_ruby/1.8/fastri/ri_index.rb:354:in
    `get_class'
    from /usr/local/lib/ruby/site_ruby/1.8/fastri/ri_index.rb:352:in
    `each'
    from /usr/local/lib/ruby/site_ruby/1.8/fastri/ri_index.rb:352:in
    `get_class'
    from
    /usr/local/lib/ruby/site_ruby/1.8/fastri/ri_service.rb:209:in `info'
    from
    /usr/local/lib/ruby/site_ruby/1.8/fastri/ri_service.rb:422:in
    `capture_stdout'
    from
    /usr/local/lib/ruby/site_ruby/1.8/fastri/ri_service.rb:208:in `info'
    from /usr/local/bin/qri:342
    from /usr/local/bin/qri:337:in `each'
    from /usr/local/bin/qri:337

    --
    matt neuburg, phd = , http://www.tidbits.com/matt/
    Leopard - http://www.takecontrolbooks.com/leopard-customizing.html
    AppleScript - http://www.amazon.com/gp/product/0596102119
    Read TidBITS! It's free and smart. http://www.tidbits.com
     
    matt neuburg, Feb 21, 2009
    #4
  5. matt neuburg

    matt neuburg Guest

    Roger Pack <> wrote:

    > > but I prefer fastri over ri, because....it's *faster* =D
    > > http://eigenclass.org/hiki/fastri

    >
    > Note also that you can lookup things in irb
    >
    > irb(main):002:0> help "String#chars"
    > ----------------------------------------------------------- String#chars
    > str.chars => anEnumerator
    > str.chars {|substr| block } => str
    > ------------------------------------------------------------------------
    > Returns an enumerator that gives each character in the string. If a
    > block is given, it iterates over each character in the string.
    >
    > "foo".chars.to_a #=> ["f","o","o"]


    But what I asked about was String.squeeze. Same problem:

    irb(main):001:0> help "String#squeeze"
    More than one method matched your request. You can refine
    your search by asking for information on one of:

    String#squeeze!, String#squeeze, String#squeeze!, String#squeeze

    Now what? m.

    --
    matt neuburg, phd = , http://www.tidbits.com/matt/
    Leopard - http://www.takecontrolbooks.com/leopard-customizing.html
    AppleScript - http://www.amazon.com/gp/product/0596102119
    Read TidBITS! It's free and smart. http://www.tidbits.com
     
    matt neuburg, Feb 21, 2009
    #5
  6. matt neuburg

    Roger Pack Guest


    > irb(main):001:0> help "String#squeeze"
    > More than one method matched your request. You can refine
    > your search by asking for information on one of:
    >
    > String#squeeze!, String#squeeze, String#squeeze!, String#squeeze
    >
    > Now what? m.


    looks like a bug. repost to ruby core?
    -=r
    --
    Posted via http://www.ruby-forum.com/.
     
    Roger Pack, Feb 21, 2009
    #6
  7. matt neuburg

    Eric Hodel Guest

    On Feb 21, 2009, at 10:10, matt neuburg wrote:

    > Roger Pack <> wrote:
    >
    >>> but I prefer fastri over ri, because....it's *faster* =D
    >>> http://eigenclass.org/hiki/fastri

    >>
    >> Note also that you can lookup things in irb
    >>
    >> irb(main):002:0> help "String#chars"
    >> -----------------------------------------------------------
    >> String#chars
    >> str.chars => anEnumerator
    >> str.chars {|substr| block } => str
    >> ------------------------------------------------------------------------
    >> Returns an enumerator that gives each character in the string.
    >> If a
    >> block is given, it iterates over each character in the string.
    >>
    >> "foo".chars.to_a #=> ["f","o","o"]

    >
    > But what I asked about was String.squeeze. Same problem:
    >
    > irb(main):001:0> help "String#squeeze"
    > More than one method matched your request. You can refine
    > your search by asking for information on one of:
    >
    > String#squeeze!, String#squeeze, String#squeeze!, String#squeeze
    >
    > Now what? m.


    You seem to have two sets of ri data installed. Try locate cdesc-
    String.yaml to see where the two sets live, then delete the one
    without documentation.
     
    Eric Hodel, Feb 25, 2009
    #7
  8. matt neuburg

    Eric Hodel Guest

    On Feb 21, 2009, at 10:10, matt neuburg wrote:

    >> but I prefer fastri over ri, because....it's *faster*

    >
    > Faster, but long ago broken OMM. It stopped working one day (after a
    > rdoc update, I think) and just never worked again. It doesn't look
    > very
    > supported and I assume it is no longer maintained...?


    RDoc 2 has a fast ri, from cache:

    $ time ri String#squeeze > /dev/null

    real 0m0.398s
    user 0m0.339s
    sys 0m0.054s
     
    Eric Hodel, Feb 25, 2009
    #8
  9. matt neuburg

    matt neuburg Guest

    Eric Hodel <> wrote:

    > > irb(main):001:0> help "String#squeeze"
    > > More than one method matched your request. You can refine
    > > your search by asking for information on one of:
    > >
    > > String#squeeze!, String#squeeze, String#squeeze!, String#squeeze
    > >
    > > Now what? m.

    >
    > You seem to have two sets of ri data installed. Try locate cdesc-
    > String.yaml to see where the two sets live, then delete the one
    > without documentation.


    Good call! That worked. Thanks! m.

    --
    matt neuburg, phd = , http://www.tidbits.com/matt/
    Leopard - http://www.takecontrolbooks.com/leopard-customizing.html
    AppleScript - http://www.amazon.com/gp/product/0596102119
    Read TidBITS! It's free and smart. http://www.tidbits.com
     
    matt neuburg, Feb 26, 2009
    #9
  10. matt neuburg

    Ryan Davis Guest

    On Feb 25, 2009, at 11:29 , Eric Hodel wrote:

    > You seem to have two sets of ri data installed. Try locate cdesc-
    > String.yaml to see where the two sets live, then delete the one
    > without documentation.


    maybe our next tweak on `gem check` should do this check too?
     
    Ryan Davis, Feb 26, 2009
    #10
  11. matt neuburg

    Eric Hodel Guest

    On Feb 26, 2009, at 00:51, Ryan Davis wrote:
    > On Feb 25, 2009, at 11:29 , Eric Hodel wrote:
    >> You seem to have two sets of ri data installed. Try locate cdesc-
    >> String.yaml to see where the two sets live, then delete the one
    >> without documentation.

    >
    > maybe our next tweak on `gem check` should do this check too?


    This one seemed to be an artifact of ruby's `make install-doc`, I'm
    unsure how to reproduce it.

    RDoc now only looks in the latest gem dirs for documentation, so this
    shouldn't happen for ri for gems even with multiple versions.
     
    Eric Hodel, Feb 26, 2009
    #11
    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. Big Bill
    Replies:
    7
    Views:
    441
    Big Bill
    May 7, 2004
  2. Mathias Waack

    squeeze and package imports

    Mathias Waack, Sep 25, 2003, in forum: Python
    Replies:
    2
    Views:
    289
    Mathias Waack
    Sep 27, 2003
  3. arnuld

    K&R2 section 2.8 (exercise 2.4) "squeeze"

    arnuld, Mar 13, 2007, in forum: C Programming
    Replies:
    5
    Views:
    478
    Barry Schwarz
    Mar 14, 2007
  4. luser-ex-troll

    META: relax topicality to squeeze the spam?

    luser-ex-troll, Mar 14, 2009, in forum: C Programming
    Replies:
    6
    Views:
    888
    luser-ex-troll
    Mar 17, 2009
  5. sara

    squeeze function

    sara, Oct 19, 2009, in forum: C++
    Replies:
    5
    Views:
    1,733
    Rolf Magnus
    Oct 19, 2009
Loading...

Share This Page