Class: Mapricot::AbstractNodeList
- Inherits:
-
Object
- Object
- Mapricot::AbstractNodeList
- Includes:
- Enumerable
- Defined in:
- lib/mapricot/abstract_doc.rb
Instance Method Summary collapse
- #[](i) ⇒ Object
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
- #first ⇒ Object
-
#initialize(node_list) ⇒ AbstractNodeList
constructor
A new instance of AbstractNodeList.
Constructor Details
#initialize(node_list) ⇒ AbstractNodeList
Returns a new instance of AbstractNodeList.
46 47 48 |
# File 'lib/mapricot/abstract_doc.rb', line 46 def initialize(node_list) @unode_list = node_list end |
Instance Method Details
#[](i) ⇒ Object
54 55 56 |
# File 'lib/mapricot/abstract_doc.rb', line 54 def [](i) AbstractNode.new(@unode_list[i]) end |
#each(&block) ⇒ Object
50 51 52 |
# File 'lib/mapricot/abstract_doc.rb', line 50 def each(&block) @unode_list.each {|unode| yield(AbstractNode.new(unode))} end |
#empty? ⇒ Boolean
62 63 64 |
# File 'lib/mapricot/abstract_doc.rb', line 62 def empty? @unode_list.empty? end |
#first ⇒ Object
58 59 60 |
# File 'lib/mapricot/abstract_doc.rb', line 58 def first AbstractNode.new(@unode_list.first) end |