diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-04-23 02:45:29 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-04-23 02:54:07 +0530 |
commit | 98b700e0bfe836c7ee4754344202dd15c7ee0f2c (patch) | |
tree | a8f9d6105f88d08b5bf6e22338726facc9e1e3b0 /railties | |
parent | eac264d74754eee6f157a75e386031ccbccd4328 (diff) | |
download | rails-98b700e0bfe836c7ee4754344202dd15c7ee0f2c.tar.gz rails-98b700e0bfe836c7ee4754344202dd15c7ee0f2c.tar.bz2 rails-98b700e0bfe836c7ee4754344202dd15c7ee0f2c.zip |
add examples for array access methods
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 4d5baff86b..c937da834c 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -2006,6 +2006,11 @@ Similarly, +from+ returns the tail from the element at the passed index on: The methods +second+, +third+, +fourth+, and +fifth+ return the corresponding element (+first+ is built-in). Thanks to social wisdom and positive constructiveness all around, +forty_two+ is also available. +<ruby> +%w(a b c d).third # => c +%w(a b c d).fifth # => nil +</ruby> + NOTE: Defined in +active_support/core_ext/array/access.rb+. h4. Random Access |