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:



821
822
823
824
825
826
827
828
829
830
831
832
833
834
# File 'lib/assert_xpath.rb', line 821

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:



812
813
814
815
# File 'lib/assert_xpath.rb', line 812

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

#textObject



817
818
819
# File 'lib/assert_xpath.rb', line 817

def text
  return root.text
end