Module: Hpricot::IMWExtensions
Instance Method Summary collapse
-
#class_of(path) ⇒ Object
Return the value of the
classattribute of the first element to matchpath. -
#contents_of(path) ⇒ Object
Return the contents of the first element to match
path. -
#path_attr(path, attr) ⇒ Object
Return the value of
attrfor the first element to matchpath.
Instance Method Details
#class_of(path) ⇒ Object
Return the value of the class attribute of the first element to match path.
19 20 21 |
# File 'lib/imw/utils/extensions/hpricot.rb', line 19 def class_of path self.path_attr(path, 'class') end |
#contents_of(path) ⇒ Object
Return the contents of the first element to match path.
6 7 8 9 |
# File 'lib/imw/utils/extensions/hpricot.rb', line 6 def contents_of path cnts = self.at path cnts.inner_html if cnts end |
#path_attr(path, attr) ⇒ Object
Return the value of attr for the first element to match path.
12 13 14 15 |
# File 'lib/imw/utils/extensions/hpricot.rb', line 12 def path_attr path, attr cnts = self.at path cnts.attributes[attr] if cnts end |