class Fancyline::History
- Fancyline::History
- Reference
- Object
Overview
Manages the input history
Defined in:
fancyline/history.crConstant Summary
-
DEFAULT_IGNORE_PREFIX =
" "
-
Default ignore prefix
-
DEFAULT_MAX_SIZE =
1000
-
Default value of maximum history size
Constructors
Instance Method Summary
-
#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 -
#ignore?(line : String | Nil)
Returns
true
if line should be ignored. -
#ignore_prefix : String
If a line to add starts with this string, it's not recorded.
-
#ignore_prefix=(ignore_prefix : String)
If a line to add starts with this string, it's not recorded.
-
#lines : Array(String)
Lines in the history.
-
#load(io : IO)
Replaces the current history with the lines from io.
-
#max : Int32
Max count of history entries to keep
-
#max=(max : Int32)
Max count of history entries to keep
-
#save(io : IO)
Writes the history into io.
Constructor Detail
Instance Method Detail
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.
If a line to add starts with this string, it's not recorded.
Lines in the history. The first entry is the oldest. Maximum size can
be controlled through #max=
Replaces the current history with the lines from io. io is read till the end, with later lines representing more-recent history entries.