lib/gitlab/shell_history.rb in gitlab-3.5.0 vs lib/gitlab/shell_history.rb in gitlab-3.6.0

- old
+ new

@@ -1,11 +1,11 @@ class Gitlab::Shell class History DEFAULT_HISTFILESIZE = 200 DEFAULT_FILE_PATH = File.join(Dir.home, '.gitlab_shell_history') - def initialize(options = {}) + def initialize(options={}) @file_path = options[:file_path] || DEFAULT_FILE_PATH Readline::HISTORY.clear end def load @@ -45,17 +45,15 @@ end def read_from_file path = history_file_path - if File.exist?(path) - File.foreach(path) { |line| yield(line) } - end + File.foreach(path) { |line| yield(line) } if File.exist?(path) rescue => error warn "History file not loaded: #{error.message}" end def max_lines - (ENV['GITLAB_HISTFILESIZE']|| DEFAULT_HISTFILESIZE).to_i + (ENV['GITLAB_HISTFILESIZE'] || DEFAULT_HISTFILESIZE).to_i end end end