aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/array/access.rb
diff options
context:
space:
mode:
authorKuldeep Aggarwal <kd.engineer@yahoo.co.in>2014-05-23 20:47:21 +0530
committerKuldeep Aggarwal <kd.engineer@yahoo.co.in>2014-05-23 20:47:21 +0530
commit3920d64479c8763e1f0a64db872e5f072268cda9 (patch)
tree5724a19d8876a3608bea1fb10e6864bdc95c5124 /activesupport/lib/active_support/core_ext/array/access.rb
parent0cc7f02b890d33a4e3d2a7e09f66781745e33820 (diff)
downloadrails-3920d64479c8763e1f0a64db872e5f072268cda9.tar.gz
rails-3920d64479c8763e1f0a64db872e5f072268cda9.tar.bz2
rails-3920d64479c8763e1f0a64db872e5f072268cda9.zip
add test cases for negative position in Array#from
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, 2 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/access.rb b/activesupport/lib/active_support/core_ext/array/access.rb
index 67f58bc0fe..d0791a161f 100644
--- a/activesupport/lib/active_support/core_ext/array/access.rb
+++ b/activesupport/lib/active_support/core_ext/array/access.rb
@@ -5,6 +5,8 @@ class Array
# %w( a b c d ).from(2) # => ["c", "d"]
# %w( a b c d ).from(10) # => []
# %w().from(0) # => []
+ # %w( a b c d ).from(-2) # => ["c", "d"]
+ # %w( a b c ).from(-10) # => []
def from(position)
self[position, length] || []
end