Class: Titi::Matcher::MatchFirstElement
- Defined in:
- lib/titi/matcher.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#match(doc) ⇒ Object
return the inner_html of the given element.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Titi::Matcher::Base
Instance Method Details
#match(doc) ⇒ Object
return the inner_html of the given element
eg.
m = MatchFirstElement.new('span#bio/a.homepage')
m.match('<span id="bio"><a class="homepage" href="http://foo.bar">My Homepage</a></span>')
# => 'My Homepage'
23 24 25 26 |
# File 'lib/titi/matcher.rb', line 23 def match doc el = doc.at(selector) or return nil matcher ? matcher.match(el) : el.inner_html end |