Method: TTY::Reader::History#push
- Defined in:
- lib/tty/reader/history.rb
permalink #push(line) ⇒ Object Also known as: <<
Add the last typed line to history buffer
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/tty/reader/history.rb', line 94 def push(line) @history.delete(line) unless @duplicates return if line.to_s.empty? || @exclude[line] @history.shift if size >= max_size @history << line @index = @history.size - 1 self end |