Class: IEgrip::NodeList

Inherits:
GripWrapper show all
Defined in:
lib/iegrip.rb

Overview

Node Collection

Direct Known Subclasses

HTMLElementCollection

Instance Method Summary collapse

Methods inherited from GripWrapper

#initialize, #ole_methodNames, #raw

Constructor Details

This class inherits a constructor from IEgrip::GripWrapper

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class IEgrip::GripWrapper

Instance Method Details

#[](index) ⇒ Object



607
608
609
610
611
612
613
614
615
616
# File 'lib/iegrip.rb', line 607

def [](index)
  result = retryCheck { index < @raw_object.length }
  return(nil) unless result
  raw_node = @raw_object.item(index)
  if raw_node.nodeType == 1
    HTMLElement.new(raw_node, @ie_obj)
  else
    Node.new(raw_node, @ie_obj)
  end
end

#eachObject



622
623
624
625
626
627
628
629
630
# File 'lib/iegrip.rb', line 622

def each
  @raw_object.each {|raw_node|
    if raw_node.nodeType == 1
      yield HTMLElement.new(raw_node, @ie_obj)
    else
      yield Node.new(raw_node, @ie_obj)
    end
  }
end

#inspectObject



632
633
634
# File 'lib/iegrip.rb', line 632

def inspect()
  "<#{self.class}>"
end

#sizeObject



618
619
620
# File 'lib/iegrip.rb', line 618

def size
  @raw_object.length
end