Class: Hpricot::Elem

Inherits:
Object show all
Defined in:
lib/hpricot_ext.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#ancestorsObject



69
70
71
72
73
74
75
76
# File 'lib/hpricot_ext.rb', line 69

def ancestors
  node, ancestors = parent, Elements[]
  while node.respond_to?(:parent) && node.parent
    ancestors << node
    node = node.parent
  end
  ancestors
end

#change_tag!(new_tag, preserve_attr = true) ⇒ Object



78
79
80
81
82
# File 'lib/hpricot_ext.rb', line 78

def change_tag!(new_tag, preserve_attr = true)
  return if not etag
  self.name = new_tag
  attributes.each {|k,v| remove_attribute(k)} if not preserve_attr
end

#stylesObject



84
85
86
# File 'lib/hpricot_ext.rb', line 84

def styles
  Styles.new self
end