G
gewton
There's a good command interpreter for ruby instead of irb? Like
ipython for python?
ipython for python?
There's a good command interpreter for ruby instead of irb? Like
ipython for python?
i always hated that it would store history entries in oldest-firstI'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?).
2008/10/20 gewton said:There's a good command interpreter for ruby instead of irb? Like
ipython for python?
hi trans!
Trans [2008-10-20 15:23]:> I've been using wirble which improves irb a bi= t (although I hate thatit 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:
=A0 require 'wirble'
=A0 # save history newest-first, instead of default oldest-first
=A0 class Wirble::History
=A0 =A0 def save_history
=A0 =A0 =A0 return unless Object.const_defined? :IRB
=A0 =A0 =A0 path, max_size, perms =3D %w{path size perms}.map { |v| cfg(v= ) }
=A0 =A0 =A0 # read lines from history, and truncate the list (if necessar= y)
=A0 =A0 =A0 #lines =3D Readline::HISTORY.to_a.uniq
=A0 =A0 =A0 lines =3D Readline::HISTORY.to_a.reverse.uniq.reverse
=A0 =A0 =A0 lines =3D lines[-max_size..-1] if lines.size > max_size
=A0 =A0 =A0 # write the history file
=A0 =A0 =A0 real_path =3D File.expand_path(path)
=A0 =A0 =A0 File.open(real_path, perms) { |fh| fh.puts lines }
=A0 =A0 =A0 say 'Saved %d lines to history file %s.' % [lines.size, path]
=A0 =A0 end
=A0 end
you could simply change the line that fills the 'lines' array to
something like this:
=A0 =A0 =A0 lines =3D Readline::HISTORY.to_a
that would be great! let me know if i can lend a hand.maybe i'll do a little work on wirble to make it more flexible
for variant preferences like ours and post a patch.
I believe what he's looking for is a *nix command shell (like sh) thatRobert said: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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.