instance method
to
Ruby on Rails 4.1.16
Since v3.0.20Signature
to(position)
Returns the beginning of the array up to position.
%w( a b c d ).to(0) # => ["a"] %w( a b c d ).to(2) # => ["a", "b", "c"] %w( a b c d ).to(10) # => ["a", "b", "c", "d"] %w().to(0) # => []
Parameters
-
positionreq
Source
# File activesupport/lib/active_support/core_ext/array/access.rb, line 18
def to(position)
first position + 1
end
Defined in activesupport/lib/active_support/core_ext/array/access.rb line 18
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Array