Module: Enumerable

Included in:
RGL::Graph
Defined in:
lib/rgl/enumerable_ext.rb

Instance Method Summary collapse

Instance Method Details

#lengthObject

Fixnum()

Return the number of elements of the Enumerable. Same as size but not all Enumerables implement size. – Should we call the methods size?



8
9
10
11
12
# File 'lib/rgl/enumerable_ext.rb', line 8

def length
  inject(0) do |sum,v|
    sum + 1
  end
end