diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-04-27 22:21:50 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-04-27 22:21:50 +0530 |
commit | 089ee31aadd881a59ad60b6dcb406600dc331bfd (patch) | |
tree | f54fc4eb084f7b49d6a3fcf0c6ef74a74b5c4d4c /railties/guides/source | |
parent | f76dd271c6c6a3ae613a37c5a3b8b13b945b5d66 (diff) | |
download | rails-089ee31aadd881a59ad60b6dcb406600dc331bfd.tar.gz rails-089ee31aadd881a59ad60b6dcb406600dc331bfd.tar.bz2 rails-089ee31aadd881a59ad60b6dcb406600dc331bfd.zip |
update the Array#from behaviour changes - returns [] if index exceeds array length
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 7bda1760a9..f2170e120b 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/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> |