Class: Hpricot::Elem

Inherits:
Object
  • Object
show all
Defined in:
lib/scrubyt/utils/ruby_extensions.rb

Instance Method Summary collapse

Instance Method Details

#ancestors(tag = nil) ⇒ Object



74
75
76
77
78
79
80
81
82
83
# File 'lib/scrubyt/utils/ruby_extensions.rb', line 74

def ancestors(tag = nil)
  element=self
  path=Hpricot::Elements.new
  while element.class != Hpricot::Doc do
    return element if (tag && (tag ==element.name))
    path.push element
    element = element.parent
  end
  path
end