Class: Titi::Matcher::Base
- Inherits:
-
Object
- Object
- Titi::Matcher::Base
- Defined in:
- lib/titi/ignore/matcher.rb
Overview
An abstract class from which to subclass specific HTML matchers.
A subclass is initialized with a selector
and an optional matcher
. The selector
is an HTML path specification used to collect elements from the document. If initialized with a matcher
, the matcher
is used to return match information from the elements; else the inner HTML is returned. Subclasses decide how the selector
will collect elements.
Direct Known Subclasses
MatchArray, MatchAttribute, MatchFirstElement, MatchRegexp, MatchRegexpRepeatedly
Instance Attribute Summary collapse
-
#matcher ⇒ Object
Returns the value of attribute matcher.
-
#options ⇒ Object
Returns the value of attribute options.
-
#selector ⇒ Object
Returns the value of attribute selector.
Instance Method Summary collapse
-
#initialize(selector, matcher = nil, options = {}) ⇒ Base
constructor
A new instance of Base.
- #match(doc) ⇒ Object
Constructor Details
#initialize(selector, matcher = nil, options = {}) ⇒ Base
Returns a new instance of Base.
17 18 19 20 21 |
# File 'lib/titi/ignore/matcher.rb', line 17 def initialize selector, matcher=nil, ={} self.selector = selector self.matcher = matcher self. = end |
Instance Attribute Details
#matcher ⇒ Object
Returns the value of attribute matcher.
14 15 16 |
# File 'lib/titi/ignore/matcher.rb', line 14 def matcher @matcher end |
#options ⇒ Object
Returns the value of attribute options.
15 16 17 |
# File 'lib/titi/ignore/matcher.rb', line 15 def @options end |
#selector ⇒ Object
Returns the value of attribute selector.
13 14 15 |
# File 'lib/titi/ignore/matcher.rb', line 13 def selector @selector end |
Instance Method Details
#match(doc) ⇒ Object
23 24 25 |
# File 'lib/titi/ignore/matcher.rb', line 23 def match doc raise "Abstract class #{self.class}" end |