Class: Lf::Filter::Regexp
- Inherits:
-
Lf::Filter
- Object
- Lf::Filter
- Lf::Filter::Regexp
- Defined in:
- lib/lf/filter/regexp.rb
Constant Summary
Constants inherited from Lf::Filter
Instance Method Summary collapse
- #apply(row) ⇒ Object
-
#initialize(arg) ⇒ Regexp
constructor
A new instance of Regexp.
Methods inherited from Lf::Filter
[], []=, filter_alias, inherited, parse
Constructor Details
#initialize(arg) ⇒ Regexp
Returns a new instance of Regexp.
4 5 6 7 |
# File 'lib/lf/filter/regexp.rb', line 4 def initialize(arg) @label, @value = *arg.split(':') @value = ::Regexp.new(@value) end |
Instance Method Details
#apply(row) ⇒ Object
9 10 11 |
# File 'lib/lf/filter/regexp.rb', line 9 def apply(row) row[@label.to_s.to_sym].match(@value) ? row : nil end |