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.
1240 1241 1242 1243 |
# File 'lib/rexle.rb', line 1240 def initialize(elements=[]) super() @elements = elements end |
Instance Method Details
#[](raw_i) ⇒ Object
1245 1246 1247 1248 1249 1250 |
# File 'lib/rexle.rb', line 1245 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
1252 |
# File 'lib/rexle.rb', line 1252 def each(&blk) @elements.each(&blk) end |
#empty? ⇒ Boolean
1253 |
# File 'lib/rexle.rb', line 1253 def empty?() @elements.empty? end |
#length ⇒ Object
1254 |
# File 'lib/rexle.rb', line 1254 def length() @elements.length end |
#to_a ⇒ Object
1255 |
# File 'lib/rexle.rb', line 1255 def to_a() @elements end |