Module: Hpricot::Elem::Trav
- Includes:
- Container::Trav
- Included in:
- Hpricot::Elem
- Defined in:
- lib/hpricot/modules.rb,
lib/hpricot/traverse.rb,
lib/hpricot/traverse.rb,
lib/hpricot/traverse.rb
Instance Method Summary
collapse
#classes, #containers, #each_child, #each_child_with_index, #each_hyperlink, #each_hyperlink_uri, #each_uri, #filter, #find_element, #following_siblings, #get_element_by_id, #get_elements_by_tag_name, #insert_after, #insert_before, #next_sibling, #preceding_siblings, #previous_sibling, #replace_child, #siblings_at, #traverse_text_internal
Methods included from Traverse
#after, #at, #before, #bogusetag?, #children_of_type, #clean_path, #comment?, #css_path, #doc?, #doctype?, #elem?, filter, #following, #get_subnode, #html, #index, #inner_html=, #inner_text, #make, #next, #node_position, #nodes_at, #position, #preceding, #previous, #procins?, #search, #swap, #text?, #to_html, #to_original_html, #to_plain_text, #traverse_element, #traverse_text, #xmldecl?, #xpath
Instance Method Details
#get_attribute(name) ⇒ Object
Also known as:
[]
818
819
820
821
822
|
# File 'lib/hpricot/traverse.rb', line 818
def get_attribute(name)
a = self.raw_attributes && self.raw_attributes[name.to_s]
a = Hpricot.uxs(a) if a
a
end
|
#has_attribute?(name) ⇒ Boolean
815
816
817
|
# File 'lib/hpricot/traverse.rb', line 815
def has_attribute?(name)
self.raw_attributes && self.raw_attributes.has_key?(name.to_s)
end
|
#remove_attribute(name) ⇒ Object
830
831
832
833
834
835
836
|
# File 'lib/hpricot/traverse.rb', line 830
def remove_attribute(name)
name = name.to_s
if has_attribute? name
altered!
self.raw_attributes.delete(name)
end
end
|
#set_attribute(name, val) ⇒ Object
Also known as:
[]=
824
825
826
827
828
|
# File 'lib/hpricot/traverse.rb', line 824
def set_attribute(name, val)
altered!
self.raw_attributes ||= {}
self.raw_attributes[name.to_s] = val.fast_xs
end
|
#traverse_all_element {|_self| ... } ⇒ Object
647
648
649
650
|
# File 'lib/hpricot/traverse.rb', line 647
def traverse_all_element(&block)
yield self
children.each {|c| c.traverse_all_element(&block) } if children
end
|
#traverse_some_element(name_set) {|_self| ... } ⇒ Object
666
667
668
669
|
# File 'lib/hpricot/traverse.rb', line 666
def traverse_some_element(name_set, &block)
yield self if name_set.include? self.name
children.each {|c| c.traverse_some_element(name_set, &block) } if children
end
|