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:



775
776
777
778
779
780
781
782
783
784
785
786
787
788
# File 'lib/assert_xpath.rb', line 775

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:



766
767
768
769
# File 'lib/assert_xpath.rb', line 766

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

#textObject



771
772
773
# File 'lib/assert_xpath.rb', line 771

def text
  return root.text
end