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



562
563
564
565
566
567
568
569
570
# File 'lib/iegrip.rb', line 562

def [](index)
  return(nil) if index >= @raw_object.length
  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



576
577
578
579
580
581
582
583
584
# File 'lib/iegrip.rb', line 576

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



586
587
588
# File 'lib/iegrip.rb', line 586

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

#sizeObject



572
573
574
# File 'lib/iegrip.rb', line 572

def size
  @raw_object.length
end