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.
1337 1338 1339 1340 |
# File 'lib/rexle.rb', line 1337 def initialize(elements=[]) super() @elements = elements end |
Instance Method Details
#[](raw_i) ⇒ Object
1342 1343 1344 1345 1346 1347 |
# File 'lib/rexle.rb', line 1342 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
1349 |
# File 'lib/rexle.rb', line 1349 def each(&blk) @elements.each(&blk) end |
#empty? ⇒ Boolean
1350 |
# File 'lib/rexle.rb', line 1350 def empty?() @elements.empty? end |
#length ⇒ Object
1351 |
# File 'lib/rexle.rb', line 1351 def length() @elements.length end |
#to_a ⇒ Object
1352 |
# File 'lib/rexle.rb', line 1352 def to_a() @elements end |