Class: Lf::Filter::Label
- Inherits:
-
Lf::Filter
- Object
- Lf::Filter
- Lf::Filter::Label
- Defined in:
- lib/lf/filter/label.rb
Constant Summary
Constants inherited from Lf::Filter
Instance Method Summary collapse
- #apply(row) ⇒ Object
-
#initialize(arg) ⇒ Label
constructor
A new instance of Label.
Methods inherited from Lf::Filter
[], []=, filter_alias, inherited, parse
Constructor Details
#initialize(arg) ⇒ Label
Returns a new instance of Label.
2 3 4 |
# File 'lib/lf/filter/label.rb', line 2 def initialize(arg) @labels = arg.split(',').map(&:strip) end |
Instance Method Details
#apply(row) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/lf/filter/label.rb', line 6 def apply(row) raw = row.reject do |key, _| !@labels.include?(key.to_s) end Lf::Row.new(raw) end |