Module: OpenfireAdmin::ElementHelper
- Defined in:
- lib/openfire_admin/html_parser.rb
Instance Method Summary collapse
Instance Method Details
#[](arg, name = nil) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/openfire_admin/html_parser.rb', line 19 def [](arg, name=nil) if arg.is_a?(Symbol) self.attributes[arg.to_s] else super end end |
#at(xpath) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/openfire_admin/html_parser.rb', line 5 def at(xpath) xpath = ".#{xpath}" if !self.is_a?(REXML::Document) and xpath =~ /^\// elm = REXML::XPath.first(self,xpath) elm.extend(ElementHelper) elm end |
#search(xpath) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/openfire_admin/html_parser.rb', line 11 def search(xpath) xpath = ".#{xpath}" if !self.is_a?(REXML::Document) and xpath =~ /^\// ret = REXML::XPath.match(self,xpath).map{|elm| elm.extend(ElementHelper) elm block_given? ? (yield elm) : elm } end |