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.



1259
1260
1261
1262
# File 'lib/rexle.rb', line 1259

def initialize(elements=[])
  super()
  @elements = elements
end

Instance Method Details

#[](raw_i) ⇒ Object



1264
1265
1266
1267
1268
1269
# File 'lib/rexle.rb', line 1264

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



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

def each(&blk) @elements.each(&blk)  end

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?()   @elements.empty?      end

#lengthObject



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

def length()   @elements.length      end

#to_aObject



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

def to_a()     @elements             end