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.



1249
1250
1251
1252
# File 'lib/rexle.rb', line 1249

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

Instance Method Details

#[](raw_i) ⇒ Object



1254
1255
1256
1257
1258
1259
# File 'lib/rexle.rb', line 1254

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



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

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

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?()   @elements.empty?      end

#lengthObject



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

def length()   @elements.length      end

#to_aObject



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

def to_a()     @elements             end