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.



1302
1303
1304
1305
# File 'lib/rexle.rb', line 1302

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

Instance Method Details

#[](raw_i) ⇒ Object



1307
1308
1309
1310
1311
1312
# File 'lib/rexle.rb', line 1307

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



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

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

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?()   @elements.empty?      end

#lengthObject



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

def length()   @elements.length      end

#to_aObject



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

def to_a()     @elements             end