Class: Scraprr::RegexpFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/scraprr/regexp_filter.rb

Instance Method Summary collapse

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