Skip to content
Browse files

update the Array#from behaviour changes - returns [] if index exceeds…

… array length
  • Loading branch information...
1 parent f76dd27 commit 089ee31aadd881a59ad60b6dcb406600dc331bfd @vijaydev vijaydev committed Apr 27, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 railties/guides/source/active_support_core_extensions.textile
View
4 railties/guides/source/active_support_core_extensions.textile
@@ -1996,11 +1996,11 @@ Active Support augments the API of arrays to ease certain ways of accessing them
[].to(7) # => []
</ruby>
-Similarly, +from+ returns the tail from the element at the passed index on:
+Similarly, +from+ returns the tail from the element at the passed index to the end. If the index is greater than the length of the array, it returns an empty array.
<ruby>
%w(a b c d).from(2) # => %w(c d)
-%w(a b c d).from(10) # => nil
+%w(a b c d).from(10) # => []
[].from(0) # => []
</ruby>

0 comments on commit 089ee31

Please sign in to comment.
Something went wrong with that request. Please try again.