Module: Hpricot::Traverse
- Defined in:
- lib/parser.rb
Instance Method Summary collapse
Instance Method Details
permalink #between(a, b) ⇒ Object
[View source]
266 267 268 |
# File 'lib/parser.rb', line 266 def between(a,b) root.search(a..b) end |
permalink #extract_text ⇒ Object
[View source]
270 271 272 273 274 275 276 |
# File 'lib/parser.rb', line 270 def extract_text t='' self.traverse_all_element do |e| t+=e.content.to_s if e.is_a?(Hpricot::Text) end t end |
permalink #in_search?(expr) ⇒ Boolean
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/parser.rb', line 242 def in_search?(expr) if expr !~ /[^a-z0-9]/ return self.name.downcase()==expr.downcase() end se_in=self.parent if expr[0..1]=='/' se_in=self.root end se_in.search(expr).each do |el| return true if el==self end # puts self.name+" "+expr return false end |
permalink #root ⇒ Object
[View source]
258 259 260 261 262 263 264 |
# File 'lib/parser.rb', line 258 def root return @root unless @root.nil? se_in=self se_in=se_in.parent until se_in.parent.nil? @root=se_in se_in end |