Class: Nekohtml::HtmlNodeList

Inherits:
HtmlThing show all
Includes:
Enumerable
Defined in:
lib/nekohtml/html_document.rb

Instance Attribute Summary

Attributes inherited from HtmlThing

#java_object

Instance Method Summary collapse

Methods inherited from HtmlThing

#at, #do_search, #search

Constructor Details

#initialize(*args) ⇒ HtmlNodeList

Returns a new instance of HtmlNodeList.



47
48
49
50
51
# File 'lib/nekohtml/html_document.rb', line 47

def initialize(*args)
  super
  # Just an alias
  @jnode_list = @java_object
end

Instance Method Details

#eachObject



57
58
59
60
61
# File 'lib/nekohtml/html_document.rb', line 57

def each
  @jnode_list.getLength().times do |i|
    yield HtmlNode.new(@jnode_list.item(i))
  end
end

#lengthObject



53
54
55
# File 'lib/nekohtml/html_document.rb', line 53

def length
  @jnode_list.getLength()
end