Module: Readline::History::Restore::AutoSave

Defined in:
lib/readline/history/restore/auto_save.rb

Constant Summary collapse

AUTOSAVE_HOME =
ENV['RUBY_READLINE_AUTOSAVE'] || ENV['HOME'] + '/.ruby_readline_history/'

Class Method Summary collapse

Class Method Details

.scriptname(options = {}) ⇒ Object

:don’t use win32



12
13
14
15
16
17
18
19
20
# File 'lib/readline/history/restore/auto_save.rb', line 12

def scriptname(options = {}) # :don't use win32
  unless fn = ENV['_']
    raise "don't found scriptfile name"
  end
  home = Pathname.new(options[:history_home] || AUTOSAVE_HOME)
  home.mkpath unless home.directory?
  history = home.join(Pathname.new(fn).realpath.to_s.gsub('/', '%23'))
  Readline::History::Restore.new(history.to_s)
end