Forum: Ruby Best Command Prompt

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F3fce5711b8b8843c598b55dba5f40c1?d=identicon&s=25 gewton (Guest)
on 2008-10-20 15:07
(Received via mailing list)
There's a good command interpreter for ruby instead of irb? Like
ipython for python?
45196398e9685000d195ec626d477f0e?d=identicon&s=25 Thomas Sawyer (7rans)
on 2008-10-20 15:25
(Received via mailing list)
On Oct 20, 9:05 am, gewton <gjha...@gmail.com> wrote:
> There's a good command interpreter for ruby instead of irb? Like
> ipython for python?

How is ipython better than irb?

I've been using wirble which improves irb a bit (although I hate that
it doesn't allow duplicate entries in the history --anyone know how to
fix?).

T.
Fe5660da5930df2d7b34b6066c2d16bb?d=identicon&s=25 Jens Wille (jwille)
on 2008-10-20 15:35
(Received via mailing list)
hi trans!

Trans [2008-10-20 15:23]:
> I've been using wirble which improves irb a bit (although I hate that
> it doesn't allow duplicate entries in the history --anyone know how to
> fix?).
i always hated that it would store history entries in oldest-first
order. so i just copied the code for save_history from wirble.rb
into my .irbrc and adjusted it accordingly:

  require 'wirble'

  # save history newest-first, instead of default oldest-first
  class Wirble::History
    def save_history
      return unless Object.const_defined? :IRB

      path, max_size, perms = %w{path size perms}.map { |v| cfg(v) }

      # read lines from history, and truncate the list (if necessary)
      #lines = Readline::HISTORY.to_a.uniq
      lines = Readline::HISTORY.to_a.reverse.uniq.reverse
      lines = lines[-max_size..-1] if lines.size > max_size

      # write the history file
      real_path = File.expand_path(path)
      File.open(real_path, perms) { |fh| fh.puts lines }
      say 'Saved %d lines to history file %s.' % [lines.size, path]
    end
  end

you could simply change the line that fills the 'lines' array to
something like this:

      lines = Readline::HISTORY.to_a

cheers
jens
E0d864d9677f3c1482a20152b7cac0e2?d=identicon&s=25 Robert Klemme (Guest)
on 2008-10-20 15:43
(Received via mailing list)
2008/10/20 gewton <gjhames@gmail.com>:
> There's a good command interpreter for ruby instead of irb? Like
> ipython for python?

What functionality are you missing in IRB?

Kind regards

robert
45196398e9685000d195ec626d477f0e?d=identicon&s=25 Thomas Sawyer (7rans)
on 2008-10-20 18:33
(Received via mailing list)
On Oct 20, 9:33 am, Jens Wille <jens.wi...@uni-koeln.de> wrote:
>   require 'wirble'
>       lines = Readline::HISTORY.to_a.reverse.uniq.reverse
> something like this:
>
>       lines = Readline::HISTORY.to_a
>

awesome. thanks jens.

maybe i'll do a little work on wirble to make it more flexible for
variant preferences like ours and post a patch.

t.
Fe5660da5930df2d7b34b6066c2d16bb?d=identicon&s=25 Jens Wille (jwille)
on 2008-10-20 18:35
(Received via mailing list)
Trans [2008-10-20 18:31]:
> maybe i'll do a little work on wirble to make it more flexible
> for variant preferences like ours and post a patch.
that would be great! let me know if i can lend a hand.

cheers
jens
6c1b9fc4a1b4b0032d3e9ddc1a11439f?d=identicon&s=25 David Warburton (modnar13)
on 2008-10-20 20:09
Robert Klemme wrote:
> 2008/10/20 gewton <gjhames@gmail.com>:
>> There's a good command interpreter for ruby instead of irb? Like
>> ipython for python?
>
> What functionality are you missing in IRB?
>
> Kind regards
>
> robert
I believe what he's looking for is a *nix command shell (like sh) that
implements ruby scripting language features.
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2008-10-20 21:10
(Received via mailing list)
On Mon, Oct 20, 2008 at 11:08 AM, David Warburton <modnar13@yahoo.com>
wrote:

> I believe what he's looking for is a *nix command shell (like sh) that
> implements ruby scripting language features.

If that's the case: <http://rush.heroku.com/>

FWIW,
This topic is locked and can not be replied to.