Class: NoraMark::NodeSet
- Inherits:
-
Object
- Object
- NoraMark::NodeSet
- Includes:
- Enumerable
- Defined in:
- lib/nora_mark/node_set.rb
Instance Method Summary collapse
- #[](n) ⇒ Object
- #each(&block) ⇒ Object
- #first ⇒ Object
-
#initialize(list = []) ⇒ NodeSet
constructor
A new instance of NodeSet.
- #last ⇒ Object
- #size ⇒ Object
- #text ⇒ Object
- #to_ary ⇒ Object
Constructor Details
Instance Method Details
#[](n) ⇒ Object
9 10 11 |
# File 'lib/nora_mark/node_set.rb', line 9 def [](n) @list[n] end |
#each(&block) ⇒ Object
17 18 19 |
# File 'lib/nora_mark/node_set.rb', line 17 def each(&block) @list.each(&block) end |
#first ⇒ Object
25 26 27 |
# File 'lib/nora_mark/node_set.rb', line 25 def first @list.first end |
#last ⇒ Object
29 30 31 |
# File 'lib/nora_mark/node_set.rb', line 29 def last @list.last end |
#size ⇒ Object
13 14 15 |
# File 'lib/nora_mark/node_set.rb', line 13 def size @list.size end |
#text ⇒ Object
33 34 35 |
# File 'lib/nora_mark/node_set.rb', line 33 def text @list.inject('') { |r, n| r << n.text } end |
#to_ary ⇒ Object
21 22 23 |
# File 'lib/nora_mark/node_set.rb', line 21 def to_ary @list.dup end |