Sha256: e9be5484fa60724437001c327dac43e11bd9b5acc8f63b2d35c4d5db8478fc07
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require_relative '../../hairballs' Hairballs.add_plugin(:irb_history, save_history: 1000, eval_history: 20, global_history_file: true) do |plugin| plugin.libraries %w(irb/ext/save-history) plugin.on_load do IRB.conf[:SAVE_HISTORY] = plugin.save_history IRB.conf[:EVAL_HISTORY] = plugin.eval_history unless plugin.global_history_file IRB.conf[:HISTORY_FILE] = "#{Dir.home}/.irb_history-#{Hairballs.project_name}" end Object.class_eval do # All of the ruby lines of code that have been executed. def history 0.upto(Readline::HISTORY.size - 1) do |i| printf "%5d %s\n", i, Readline::HISTORY[i] end end # Execute one or many lines of Ruby from +history+. # # @param command_numbers [Fixnum,Range] def _!(command_numbers) cmds = if command_numbers.is_a? Range command_numbers.to_a.map { |i| Readline::HISTORY[i] } else [Readline::HISTORY[command_numbers]] end cmds.each { |cmd| send(cmd) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hairballs-0.0.1 | lib/hairballs/plugins/irb_history.rb |