aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-05-23 14:59:55 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-05-23 14:59:55 -0300
commitfbdcba86cf0a174ddcc8b913db703c5e69d77f9f (patch)
treebdbe7310f423a5a11683fb078ca55a6e22b236dc /activesupport/lib/active_support
parent02f3081332862e031bf99fa133bb5f79f9e59be0 (diff)
parent3920d64479c8763e1f0a64db872e5f072268cda9 (diff)
downloadrails-fbdcba86cf0a174ddcc8b913db703c5e69d77f9f.tar.gz
rails-fbdcba86cf0a174ddcc8b913db703c5e69d77f9f.tar.bz2
rails-fbdcba86cf0a174ddcc8b913db703c5e69d77f9f.zip
Merge pull request #15275 from kuldeepaggarwal/add-test
add test cases for negative position in Array#from
Diffstat (limited to 'activesupport/lib/active_support')
-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