From 089ee31aadd881a59ad60b6dcb406600dc331bfd Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 27 Apr 2011 22:21:50 +0530 Subject: update the Array#from behaviour changes - returns [] if index exceeds array length --- railties/guides/source/active_support_core_extensions.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties') 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) # => [] -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. %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) # => [] -- cgit v1.2.3