Fancyline::History
Inherits Reference / Object
Manages the input history
Constants
DEFAULT_IGNORE_PREFIX = " "
Default ignore prefix
DEFAULT_MAX_SIZE = 1000
Default value of maximum history size
Constructors
new(max : Int32 = DEFAULT_MAX_SIZE)
SourceInstance methods
add(line : String | Nil) : Bool
Adds line to the history, except if:
- line is nil
- line is empty
- line only consists of blank characters
- line starts with the
#ignore_prefix - line matches the most recent entry in the history
Returns true if the line was added.
ignore_prefix=(ignore_prefix : String)
If a line to add starts with this string, it's not recorded.
lines
Lines in the history. The first entry is the oldest. Maximum size can
be controlled through #max=
load(io : IO)
Replaces the current history with the lines from io. io is read till the end, with later lines representing more-recent history entries.