Class: OpenfireAdmin::HtmlParser
- Inherits:
-
Object
- Object
- OpenfireAdmin::HtmlParser
- Defined in:
- lib/openfire_admin/html_parser.rb
Overview
html parser wrapper
Instance Method Summary collapse
-
#at(xpath) ⇒ REXML::Element extends ElementHelper
find first element by xpath.
-
#initialize(html) ⇒ HtmlParser
constructor
parse html and build xml.
-
#search(xpath, &proc) ⇒ Array<REXML::Element extends ElementHelper>
find elements by xpath.
Constructor Details
#initialize(html) ⇒ HtmlParser
parse html and build xml
43 44 45 46 |
# File 'lib/openfire_admin/html_parser.rb', line 43 def initialize(html) @doc = REHTML.to_rexml(html) @doc.extend(ElementHelper) end |
Instance Method Details
#at(xpath) ⇒ REXML::Element extends ElementHelper
find first element by xpath
58 59 60 |
# File 'lib/openfire_admin/html_parser.rb', line 58 def at(xpath) @doc.at(xpath) end |
#search(xpath, &proc) ⇒ Array<REXML::Element extends ElementHelper>
find elements by xpath
51 52 53 |
# File 'lib/openfire_admin/html_parser.rb', line 51 def search(xpath, &proc) @doc.search(xpath, &proc) end |