lib/rib/more/multiline_history_file.rb in rib-1.0.0 vs lib/rib/more/multiline_history_file.rb in rib-1.0.1

- old
+ new

@@ -7,11 +7,11 @@ # --------------- Rib API --------------- def before_loop return super if MultilineHistoryFile.disabled? - config[:multiline_history_file_token] ||= ' ' + multiline_history_file_token super end # --------------- Plugin API --------------- @@ -21,11 +21,11 @@ File.exist?(history_file_path) && history.empty? && IO.readlines(history_file_path).each{ |line| if line.end_with?( "#{config[:multiline_history_file_token]}\n") buffer << line[0... - -config[:multiline_history_file_token].size-1] + "\n" + -multiline_history_file_token.size-1] + "\n" else history << (buffer.join + line).chomp buffer = [] end } @@ -36,7 +36,14 @@ # TODO: hisotroy.map is MRI 1.9+ config[:history] = history.to_a.map{ |line| line.gsub("\n", "#{config[:multiline_history_file_token]}\n") } super + end + + + + private + def multiline_history_file_token + config[:multiline_history_file_token] ||= ' ' end end