aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/array/access.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/array/access.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/array/access.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/access.rb b/activesupport/lib/active_support/core_ext/array/access.rb
index a2086fa3e5..2bba0974b3 100644
--- a/activesupport/lib/active_support/core_ext/array/access.rb
+++ b/activesupport/lib/active_support/core_ext/array/access.rb
@@ -6,7 +6,7 @@ class Array
# %w( a b c d ).from(10) # => %w()
# %w().from(0) # => %w()
def from(position)
- position > length ? [] : self[position..-1]
+ [position, length] || []
end
# Returns the beginning of the array up to +position+.