Editing in Ruby

Discussion in 'Ruby' started by Shreyas, Oct 17, 2005.

  1. Shreyas

    Shreyas Guest

    Hi all --

    I just started reading up on programming in Ruby. I used to program in
    VB / VB.NET, and have done some programming in Java, etc etc. In any
    case, I am looking over the basic "how to program in Ruby" tutorials on
    the web just to get a general idea of how this programming language
    works, and I was wondering if there was any editor out there that had
    "autocomplete," i.e., one that will automatically give me a list of
    functions for the object in question whenever I type in the '.', and
    also give me the tooltips once I start a function.
    I installed the one-click Ruby installer (I'm running this on WinXP),
    and it gave me a copy of SciTE, but it looks like I need to point it to
    a text file listing the entire ruby API, and I don't know where to find
    that (I've tried Googling for it, but to no avail). I also have
    installed RDE, and FreeRide comes with the installer too (but, of
    course, FreeRide seems to run on top of Scintilla).
    In any case, I was wondering if anyone knew either (a) how to get a
    list of all the functions in ruby exported to an API file, or (b) if
    there is an editor out there that can help out. Many times when I'm
    programming, it's nice to just be able to see what the valid functions
    are for the object in question, rather than having to look it up in the
    API documentation.

    Thanks!
    Shreyas
    Shreyas, Oct 17, 2005
    #1
    1. Advertising

  2. Shreyas

    SB Guest

    I'm a newbie to all things in general but I think the Ruby Development
    Tools for Eclipse is the closest thing I know of.

    http://rubyeclipse.sourceforge.net/

    However, as someone noted, it is a dynamic language and so
    autocomplete (ctrl+space in Eclipse) leaves much to be desired and is
    probably not what you expect.

    For Eclipse+Ruby+Rails check out the following:

    Setting Up an Eclipse Environment for Ruby and Rails
    http://www.napcs.com/howto/railsonwindows.html

    Radrails (Eclipse rich client packaged for Rails+Ruby)
    http://www.radrails.org/

    Radrails Plugin for people already on Eclipse
    http://download.radrails.org/update/


    Maybe someone has a better setup or solution.



    2005/10/17, Shreyas <>:
    > Hi all --
    >
    > I just started reading up on programming in Ruby. I used to program in
    > VB / VB.NET, and have done some programming in Java, etc etc. In any
    > case, I am looking over the basic "how to program in Ruby" tutorials on
    > the web just to get a general idea of how this programming language
    > works, and I was wondering if there was any editor out there that had
    > "autocomplete," i.e., one that will automatically give me a list of
    > functions for the object in question whenever I type in the '.', and
    > also give me the tooltips once I start a function.
    > I installed the one-click Ruby installer (I'm running this on WinXP),
    > and it gave me a copy of SciTE, but it looks like I need to point it to
    > a text file listing the entire ruby API, and I don't know where to find
    > that (I've tried Googling for it, but to no avail). I also have
    > installed RDE, and FreeRide comes with the installer too (but, of
    > course, FreeRide seems to run on top of Scintilla).
    > In any case, I was wondering if anyone knew either (a) how to get a
    > list of all the functions in ruby exported to an API file, or (b) if
    > there is an editor out there that can help out. Many times when I'm
    > programming, it's nice to just be able to see what the valid functions
    > are for the object in question, rather than having to look it up in the
    > API documentation.
    >
    > Thanks!
    > Shreyas
    >
    >
    >
    SB, Oct 17, 2005
    #2
    1. Advertising

  3. Shreyas

    Curt Hibbs Guest

    ------=_Part_18794_12674818.1129522050368
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: inline

    Its true that autocomplete is a difficult proposition in a dynamic language=
    Curt Hibbs, Oct 17, 2005
    #3
  4. Shreyas

    Greg Millam Guest

    Shreyas wrote:
    > In any case, I was wondering if anyone knew either (a) how to get a
    > list of all the functions in ruby exported to an API file, or (b) if
    > there is an editor out there that can help out. Many times when I'm
    > programming, it's nice to just be able to see what the valid
    > functions are for the object in question, rather than having to look
    > it up in the API documentation.


    Use irb with irb/completion

    $ irb
    irb(main):001:0> require 'irb/completion'
    => true
    irb(main):002:0> f = "Hello, world!"
    => "Hello, world!"
    irb(main):003:0> f.downcase
    f.downcase f.downcase!
    irb(main):003:0> f.downcase

    If you hit f.down<tab>, it'll complete to downcase. hit it twice, and
    it'll show "f.downcase f.downcase!"

    If you want to find other methods, try using f.methods.grep

    irb(main):004:0> f.methods.grep /case/
    => ["downcase", "downcase!", "casecmp", "swapcase", "swapcase!",
    "upcase", "upcase!"]

    f.case<tab> will pull out f.casecmp for you.

    This works with any valid object in irb.

    irb(main):005:0> i = 1
    => 1
    irb(main):006:0> i.methods.grep /case/
    => []
    irb(main):007:0> i.methods.grep /zero/
    => ["zero?", "nonzero?"]


    It's very handy, and I use it a lot, even though I've been rubying for
    about 3 years.

    Hope that helps you, too!

    - Greg
    Greg Millam, Oct 17, 2005
    #4
  5. Shreyas

    Jeff Wood Guest

    ------=_Part_8720_17739989.1129537961204
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: inline

    I agree with Greg.
    Add a bit of history capture to your .irbrc script and boom, you've got an
    auto-complete, code by exploration environment.
    j.

    On 10/16/05, Greg Millam <> wrote:
    >
    > Shreyas wrote:
    > > In any case, I was wondering if anyone knew either (a) how to get a
    > > list of all the functions in ruby exported to an API file, or (b) if
    > > there is an editor out there that can help out. Many times when I'm
    > > programming, it's nice to just be able to see what the valid
    > > functions are for the object in question, rather than having to look
    > > it up in the API documentation.

    >
    > Use irb with irb/completion
    >
    > $ irb
    > irb(main):001:0> require 'irb/completion'
    > =3D> true
    > irb(main):002:0> f =3D "Hello, world!"
    > =3D> "Hello, world!"
    > irb(main):003:0> f.downcase
    > f.downcase f.downcase!
    > irb(main):003:0> f.downcase
    >
    > If you hit f.down<tab>, it'll complete to downcase. hit it twice, and
    > it'll show "f.downcase f.downcase!"
    >
    > If you want to find other methods, try using f.methods.grep
    >
    > irb(main):004:0> f.methods.grep /case/
    > =3D> ["downcase", "downcase!", "casecmp", "swapcase", "swapcase!",
    > "upcase", "upcase!"]
    >
    > f.case<tab> will pull out f.casecmp for you.
    >
    > This works with any valid object in irb.
    >
    > irb(main):005:0> i =3D 1
    > =3D> 1
    > irb(main):006:0> i.methods.grep /case/
    > =3D> []
    > irb(main):007:0> i.methods.grep /zero/
    > =3D> ["zero?", "nonzero?"]
    >
    >
    > It's very handy, and I use it a lot, even though I've been rubying for
    > about 3 years.
    >
    > Hope that helps you, too!
    >
    > - Greg
    >
    >



    --
    "http://ruby-lang.org -- do you ruby?"

    Jeff Wood

    ------=_Part_8720_17739989.1129537961204--
    Jeff Wood, Oct 17, 2005
    #5
  6. Shreyas

    Rob . Guest

    On 10/17/05, Shreyas <> wrote:
    > I was wondering if there was any editor out there
    > that had "autocomplete," i.e., one that will
    > automatically give me a list of
    > functions for the object in question whenever I
    > type in the '.'


    The jEdit Ruby Editor Plugin provides method autocompletion for the
    Ruby system classes:

    http://www.jedit.org/ruby/

    > I was wondering if anyone knew either
    > (a) how to get a list of all the functions in
    > ruby exported to an API file, or
    > (b) if there is an editor out there that can help
    > out.
    > Many times when I'm programming, it's nice to just
    > be able to see what the valid functions
    > are for the object in question


    The jEdit Ruby Editor Plugin has an integrated documentation panel
    that shows you method RDocs as you scroll the autocompletion list. You
    can also type search terms into this panel, here's a screenshot:

    http://www.jedit.org/ruby/images/jedit_ruby_editor_plugin.png

    cheers,
    Rob
    http://www.jedit.org/ruby/
    Rob ., Oct 19, 2005
    #6
  7. Shreyas

    Rob . Guest

    On 10/17/05, Curt Hibbs <> wrote:
    > Its true that autocomplete is a difficult
    > proposition in a dynamic language.
    > There is work being done on this, but nothing yet
    > that is any good. Anyway,
    > don't expect to find usuable autocomplete anywhere
    > in the near future.


    Curt, have you tried out the jEdit Ruby Editor Plugin? It provides
    type-based method completion for the Ruby system classes. Blog based
    feedback suggests that this is a usable autocomplete tool in
    combination with other plugin features like the integrated RDoc
    viewer[1].

    In the short term I intend to extend the method autocompletion
    functionality to autocomplete based on methods listed in imported
    RDocs. So you'd be able to import RDocs for your own classes or gems
    and autocomplete on your own methods.

    > I disagree that IDE advice, though. One of the nice
    > things you can get from the current batch of IDEs is
    > code navigation -- a hierarchical tree that
    > graphically shows you the modules/classes/methods of
    > the file being edited, ...
    >
    > FreeRIDE has this, so does the RDT plugin for
    > Eclipse (both are free).


    The jEdit Ruby Editor Plugin also shows a hierarchical tree of the
    Ruby code structure, in a dockable side panel and also in a key-bound
    popup dialog. In the popup dialog you're able to navigate to a method
    via type-ahead selection.

    Rob
    http://www.jedit.org/ruby/

    [1]http://jroller.com/page/thuss?entry=3Din_search_of_a_ruby
    http://blog.corvideon.ie/2005/10/06/a-quick-review-of-jedit-as-a-ruby-on-ra=
    ils-ide/
    http://wqoq.com/2005/08/24/yarpa-the-quest-for-a-ruby-editor/
    http://livsey.org/2005/07/13/editors-and-ides/
    Rob ., Oct 19, 2005
    #7
  8. Shreyas

    Curt Hibbs Guest

    ------=_Part_4471_24561126.1129735939123
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: inline

    On 10/19/05, Rob . <> wrote:
    >
    > On 10/17/05, Curt Hibbs <> wrote:
    > > Its true that autocomplete is a difficult
    > > proposition in a dynamic language.
    > > There is work being done on this, but nothing yet
    > > that is any good. Anyway,
    > > don't expect to find usuable autocomplete anywhere
    > > in the near future.

    >
    > Curt, have you tried out the jEdit Ruby Editor Plugin? It provides
    > type-based method completion for the Ruby system classes. Blog based
    > feedback suggests that this is a usable autocomplete tool in
    > combination with other plugin features like the integrated RDoc
    > viewer[1].
    >


    I'll have t give it a try... thanks!

    Curt

    ------=_Part_4471_24561126.1129735939123--
    Curt Hibbs, Oct 19, 2005
    #8
  9. Shreyas

    Guest

    > and I was wondering if there was any editor out there that
    > had "autocomplete," i.e., one that will automatically give
    > me a list of functions for the object in question whenever
    > I type in the '.'


    The Zeus for Windows IDE uses Exuberant Ctags to do it's
    class browsing and intellisensing:

    http://www.zeusedit.com/features.html

    The Exuberant Ctags home page lists Ruby as one of the
    supported languages:

    http://ctags.sourceforge.net/languages.html

    so in theory Zeus will do intellisensing and class browsing
    for the Ruby language.

    But for this to work, a minimal amount of configuration will
    be needed. For example this link:

    http://www.zeusedit.com/forum/viewtopic.php?t=185

    Shows how Zeus can be configured to provide intellisensing
    for the C# and Mono languages.


    Jussi Jumppanen
    Author: Zeus for Windows IDE
    Note: Zeus is shareware (45 day trial).
    , Oct 28, 2005
    #9
  10. Shreyas

    Joe Van Dyk Guest

    On 10/16/05, Curt Hibbs <> wrote:
    > Its true that autocomplete is a difficult proposition in a dynamic langua=

    ge.
    > There is work being done on this, but nothing yet that is any good. Anywa=

    y,
    > don't expect to find usuable autocomplete anywhere in the near future.
    >
    > I disagree that IDE advice, though. One of the nice things you can get fr=

    om
    > the current batch of IDEs is code navigation -- a hierarchical tree that
    > graphically shows you the modules/classes/methods of the file being edite=

    d,
    > and you can click on one of these to navigate to that element in the code=
    Joe Van Dyk, Oct 28, 2005
    #10
    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. =?Utf-8?B?QmFza2FyYW4uSy5S?=

    Disable editing a particaular column in a datagrid

    =?Utf-8?B?QmFza2FyYW4uSy5S?=, Sep 18, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    5,175
    Jonathan Allen
    Sep 25, 2004
  2. Replies:
    0
    Views:
    561
  3. Sam Roberts
    Replies:
    6
    Views:
    108
    Sam Roberts
    Nov 15, 2004
  4. anne001
    Replies:
    1
    Views:
    345
  5. Nathan Oyama
    Replies:
    10
    Views:
    224
    Lars Christensen
    Jan 13, 2010
Loading...

Share This Page