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



532
533
534
535
536
537
538
539
540
# File 'lib/iegrip.rb', line 532

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



546
547
548
549
550
551
552
553
554
# File 'lib/iegrip.rb', line 546

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



556
557
558
# File 'lib/iegrip.rb', line 556

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

#sizeObject



542
543
544
# File 'lib/iegrip.rb', line 542

def size
  @raw_object.length
end