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.
1272 1273 1274 1275 |
# File 'lib/rexle.rb', line 1272 def initialize(elements=[]) super() @elements = elements end |
Instance Method Details
#[](raw_i) ⇒ Object
1277 1278 1279 1280 1281 1282 |
# File 'lib/rexle.rb', line 1277 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
1284 |
# File 'lib/rexle.rb', line 1284 def each(&blk) @elements.each(&blk) end |
#empty? ⇒ Boolean
1285 |
# File 'lib/rexle.rb', line 1285 def empty?() @elements.empty? end |
#length ⇒ Object
1286 |
# File 'lib/rexle.rb', line 1286 def length() @elements.length end |
#to_a ⇒ Object
1287 |
# File 'lib/rexle.rb', line 1287 def to_a() @elements end |