puts Readline::HISTORY.to_a
Beautiful! Thanks!
If you want to wrap it up, add this to your ~/.irbrc file (which gets loaded before your irb sessions):
def irb_history( count = nil ) hist = Readline::HISTORY.to_a
if count len = hist.length from = len - count from = 0 if from < 0 puts "len: #{len}, count: #{count}, from: #{from}, hist.class: #{hist.class}, hist.length: #{hist.length}" hist[from..-1] else hist end end
I'm not sure how the formatting will work.
Comments
Beautiful! Thanks!
— John on January 18, 2013, 08:57 PM UTCIf you want to wrap it up, add this to your ~/.irbrc file (which gets loaded before your irb sessions):
def irb_history( count = nil )
hist = Readline::HISTORY.to_a
if count
len = hist.length
from = len - count
from = 0 if from < 0
puts "len: #{len}, count: #{count}, from: #{from}, hist.class: #{hist.class}, hist.length: #{hist.length}"
hist[from..-1]
else
hist
end
end
I'm not sure how the formatting will work.
— Bryce on June 23, 2014, 09:02 PM UTC