Class: Hpricot::Doc

Inherits:
Object
  • Object
show all
Includes:
AssertXPath::CommonXPathExtensions
Defined in:
lib/assert_xpath.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from AssertXPath::CommonXPathExtensions

#identifiable?, #raise_magic_member_not_found, #symbolic?, #tribute

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object

:nodoc:



800
801
802
803
804
805
806
807
808
809
810
811
812
813
# File 'lib/assert_xpath.rb', line 800

def method_missing(*args, &block) #:nodoc:
  # if got = search(symbol).first get first descendant working here!
  #  ERGO  call root here
  symbol = args.first.to_s.sub(/\!$/, '')

  root.children.grep(Hpricot::Elem).each do |kid|
    if kid.name == symbol
      return kid.drill(&block)
        #  ERGO  assert on return value
        #  ERGO  pass kid in for if you want it
    end
  end
  # ERGO  raise here?
end

Instance Method Details

#[](index) ⇒ Object

:nodoc:



791
792
793
794
# File 'lib/assert_xpath.rb', line 791

def [](index) #:nodoc:
  return root[index]  if symbolic? index
  super
end

#textObject



796
797
798
# File 'lib/assert_xpath.rb', line 796

def text
  return root.text
end