kernel/common/array.rb
# Returns the first or first n elements of the Array.
# If no argument is given, returns nil if the item
# is not found. If there is an argument, an empty
# Array is returned instead.
Returns the first or first n elements of the Array.
If no argument is given, returns nil if the item
is not found. If there is an argument, an empty
Array is returned instead.
Returns the first or first n elements of the Array . If no argument is given returns nil if the item is not found . If there is an argument an empty Array is returned instead .
def first(n = Undefined)
    return at(0) if n.equal? Undefined
    n = Type.coerce_to n, Fixnum, :to_int
    raise ArgumentError, "Size must be positive" if n < 0
    Array.new(self[0...n])
  end
def first ( n = Undefined ) return at ( 0 ) if n . equal? Undefined n = Type . coerce_to n , Fixnum , :to_int raise ArgumentError , "Size must be positive" if n < 0 Array . new ( self [ 0 ... n ] ) end
Returns the first or first n elements of the Array.
Returns the first or first n elements of the Array .
n
<not_specific>