Class: IMW::Parsers::HtmlMatchers::MatchProc
- Inherits:
-
MatchFirstElement
- Object
- Matcher
- MatchFirstElement
- IMW::Parsers::HtmlMatchers::MatchProc
- Defined in:
- lib/imw/parsers/html_parser/matchers.rb
Overview
FIXME is there really a need for this separate class? why can’t MatchFirstElement.match accept a block?
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#proc ⇒ Object
Returns the value of attribute proc.
Attributes inherited from Matcher
Instance Method Summary collapse
-
#initialize(selector, proc, matcher = nil, options = {}) ⇒ MatchProc
constructor
A new instance of MatchProc.
- #match(doc) ⇒ Object
Constructor Details
#initialize(selector, proc, matcher = nil, options = {}) ⇒ MatchProc
Returns a new instance of MatchProc.
61 62 63 64 65 |
# File 'lib/imw/parsers/html_parser/matchers.rb', line 61 def initialize selector, proc, matcher=nil, ={} super selector, matcher self. = self.proc = proc end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
60 61 62 |
# File 'lib/imw/parsers/html_parser/matchers.rb', line 60 def @options end |
#proc ⇒ Object
Returns the value of attribute proc.
59 60 61 |
# File 'lib/imw/parsers/html_parser/matchers.rb', line 59 def proc @proc end |
Instance Method Details
#match(doc) ⇒ Object
66 67 68 69 |
# File 'lib/imw/parsers/html_parser/matchers.rb', line 66 def match doc val = super doc val ? self.proc.call(val) : self.proc.call(doc) end |