mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Fixed comments indent, make histignore lines match pattern
This commit is contained in:
parent
7f30e62270
commit
ae72ad5846
1 changed files with 3 additions and 4 deletions
|
@ -56,7 +56,7 @@ class Pry
|
|||
alias << push
|
||||
|
||||
# Clear this session's history. This won't affect the contents of the
|
||||
# history file.
|
||||
# history file.
|
||||
def clear
|
||||
@clearer.call
|
||||
@original_lines = 0
|
||||
|
@ -90,15 +90,14 @@ class Pry
|
|||
private
|
||||
|
||||
# Check if the line match any option in the histignore
|
||||
# [Pry.config.history.histignore]
|
||||
# [Pry.config.history.histignore]
|
||||
# @return [Boolean] a boolean that notifies if the line was found in the
|
||||
# histignore array.
|
||||
def should_ignore?(line)
|
||||
hist_ignore = Pry.config.history.histignore
|
||||
return false if hist_ignore.nil? || hist_ignore.empty?
|
||||
|
||||
strings, regex = hist_ignore.partition { |w| w.is_a?(String) }
|
||||
regex.any? { |r| line.to_s.match(r) } || strings.include?(line)
|
||||
hist_ignore.any? { |p| line.to_s.match(p) }
|
||||
end
|
||||
|
||||
# The default loader. Yields lines from `Pry.history.config.file`.
|
||||
|
|
Loading…
Reference in a new issue