Class: Scraprr::RegexpFilter
- Inherits:
-
Object
- Object
- Scraprr::RegexpFilter
- Defined in:
- lib/scraprr/regexp_filter.rb
Instance Method Summary collapse
-
#initialize(chain, regexp) ⇒ RegexpFilter
constructor
A new instance of RegexpFilter.
- #run(value) ⇒ Object
Constructor Details
#initialize(chain, regexp) ⇒ RegexpFilter
Returns a new instance of RegexpFilter.
3 4 5 6 |
# File 'lib/scraprr/regexp_filter.rb', line 3 def initialize(chain, regexp) @chain = chain @regexp = regexp end |
Instance Method Details
#run(value) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/scraprr/regexp_filter.rb', line 8 def run(value) match = @regexp.match(@chain.run(value)) if match match[1] end end |