Class: Kiba::Uncommon::Transforms::RegexMatcher
- Inherits:
-
Object
- Object
- Kiba::Uncommon::Transforms::RegexMatcher
- Defined in:
- lib/kiba/uncommon/transforms/regex_matcher.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#regex ⇒ Object
readonly
Returns the value of attribute regex.
Instance Method Summary collapse
-
#initialize(field, regex) ⇒ RegexMatcher
constructor
A new instance of RegexMatcher.
- #process(row) ⇒ Object
Constructor Details
#initialize(field, regex) ⇒ RegexMatcher
Returns a new instance of RegexMatcher.
14 15 16 17 |
# File 'lib/kiba/uncommon/transforms/regex_matcher.rb', line 14 def initialize(field, regex) @field = field @regex = regex end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
10 11 12 |
# File 'lib/kiba/uncommon/transforms/regex_matcher.rb', line 10 def field @field end |
#regex ⇒ Object (readonly)
Returns the value of attribute regex.
11 12 13 |
# File 'lib/kiba/uncommon/transforms/regex_matcher.rb', line 11 def regex @regex end |
Instance Method Details
#process(row) ⇒ Object
20 21 22 |
# File 'lib/kiba/uncommon/transforms/regex_matcher.rb', line 20 def process(row) (regex =~ row.fetch(field)) ? row : nil end |