Class: Rexle::Elements
Instance Method Summary collapse
- #[](raw_i) ⇒ Object
- #each(&blk) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(elements = []) ⇒ Elements
constructor
A new instance of Elements.
- #length ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(elements = []) ⇒ Elements
Returns a new instance of Elements.
1310 1311 1312 1313 |
# File 'lib/rexle.rb', line 1310 def initialize(elements=[]) super() @elements = elements end |
Instance Method Details
#[](raw_i) ⇒ Object
1315 1316 1317 1318 1319 1320 |
# File 'lib/rexle.rb', line 1315 def [](raw_i) raise 'Rexle::Elements index (-1) must be >= 1' unless raw_i > 0 i = raw_i - 1 @elements[i] end |
#each(&blk) ⇒ Object
1322 |
# File 'lib/rexle.rb', line 1322 def each(&blk) @elements.each(&blk) end |
#empty? ⇒ Boolean
1323 |
# File 'lib/rexle.rb', line 1323 def empty?() @elements.empty? end |
#length ⇒ Object
1324 |
# File 'lib/rexle.rb', line 1324 def length() @elements.length end |
#to_a ⇒ Object
1325 |
# File 'lib/rexle.rb', line 1325 def to_a() @elements end |