class MiniReadline::History
Support for the edit history.
Public Class Methods
new(buffer)
click to toggle source
Setup the history array of the mini line editor.
# File lib/mini_readline/read_line/history.rb, line 10 def initialize(buffer) @_buffer = buffer goto_end_of_history end
Public Instance Methods
append_history(str)
click to toggle source
Append a string to the history buffer if enabled.
# File lib/mini_readline/read_line/history.rb, line 47 def append_history(str) return if @options[:no_blanks] && str.strip.empty? if history.include?(str) if @options[:no_dups] return if @options[:no_move] history.delete(str) end end history << str end
get_next_history()
click to toggle source
Get the next history string
# File lib/mini_readline/read_line/history.rb, line 37 def get_next_history if @history_cursor < history.length @history_cursor += 1 history[@history_cursor] || "" else false end end
get_previous_history()
click to toggle source
Get the previous history string.
# File lib/mini_readline/read_line/history.rb, line 27 def get_previous_history if @history_cursor > 0 @history_cursor -= 1 self.history[@history_cursor] else false end end
goto_end_of_history()
click to toggle source
Go to the end of the history array.
# File lib/mini_readline/read_line/history.rb, line 22 def goto_end_of_history @history_cursor = history.length end
history()
click to toggle source
Get the history buffer associated with this instance.
# File lib/mini_readline/read_line/history.rb, line 62 def history @_buffer end
initialize_parms(options)
click to toggle source
Get the history object ready for the next read line operation.
# File lib/mini_readline/read_line/history.rb, line 16 def initialize_parms(options) @options = options goto_end_of_history end