Class: InteractiveS3::History

Inherits:
Object
  • Object
show all
Defined in:
lib/interactive_s3/history.rb

Constant Summary collapse

HISTORY_FILE =
"#{Dir.home}/.is3_history"
HISTORY_SIZE =
500

Instance Method Summary collapse

Instance Method Details

#loadObject



6
7
8
9
10
11
12
# File 'lib/interactive_s3/history.rb', line 6

def load
  if file_exist?
    File.read(file_path).each_line do |line|
      Readline::HISTORY << line.chomp
    end
  end
end

#saveObject



14
15
16
# File 'lib/interactive_s3/history.rb', line 14

def save
  File.write(file_path, Readline::HISTORY.to_a.last(history_size).join("\n"))
end