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.



1350
1351
1352
1353
# File 'lib/rexle.rb', line 1350

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

Instance Method Details

#[](raw_i) ⇒ Object



1355
1356
1357
1358
1359
1360
# File 'lib/rexle.rb', line 1355

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



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

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

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?()   @elements.empty?      end

#lengthObject



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

def length()   @elements.length      end

#to_aObject



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

def to_a()     @elements             end