Class: Vaulty::Output::HighlightFilter
- Inherits:
-
Object
- Object
- Vaulty::Output::HighlightFilter
- Defined in:
- lib/vaulty/output/table.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#matching ⇒ Object
readonly
Returns the value of attribute matching.
Instance Method Summary collapse
- #call(val, _row, _column) ⇒ Object
-
#initialize(matching: [], color: :red) ⇒ HighlightFilter
constructor
A new instance of HighlightFilter.
- #pastel ⇒ Object
Constructor Details
#initialize(matching: [], color: :red) ⇒ HighlightFilter
Returns a new instance of HighlightFilter.
5 6 7 8 |
# File 'lib/vaulty/output/table.rb', line 5 def initialize(matching: [], color: :red) @matching = matching @color = color end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
4 5 6 |
# File 'lib/vaulty/output/table.rb', line 4 def color @color end |
#matching ⇒ Object (readonly)
Returns the value of attribute matching.
4 5 6 |
# File 'lib/vaulty/output/table.rb', line 4 def matching @matching end |
Instance Method Details
#call(val, _row, _column) ⇒ Object
10 11 12 |
# File 'lib/vaulty/output/table.rb', line 10 def call(val, _row, _column) matching.include?(val.strip) ? pastel.decorate(val, color) : val end |
#pastel ⇒ Object
14 15 16 |
# File 'lib/vaulty/output/table.rb', line 14 def pastel Pastel::Color.new(enabled: true) end |