Class: Hpricot::Elem

Inherits:
Object
  • Object
show all
Defined in:
lib/google-video.rb

Overview

Extension to Hpricot for our own parsing purposes.

Instance Method Summary collapse

Instance Method Details

#all_textObject

add in an easy way to gather all raw text content from within an element. the latest unstable version of hpricot has some useful routines like this already but we’d like to use the gem-installable version for now so we have to go it alone.



29
30
31
32
33
# File 'lib/google-video.rb', line 29

def all_text
  text = ''
  each_child { |c| text << c.to_s if c.is_a?(Hpricot::Text) }
  text
end