Class: Rexle::Elements

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rexle.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


1285
# File 'lib/rexle.rb', line 1285

def empty?()   @elements.empty?      end

#lengthObject



1286
# File 'lib/rexle.rb', line 1286

def length()   @elements.length      end

#to_aObject



1287
# File 'lib/rexle.rb', line 1287

def to_a()     @elements             end