1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

add examples for array access methods

This commit is contained in:
Vijay Dev 2011-04-23 02:45:29 +05:30
parent eac264d747
commit 98b700e0bf

View file

@ -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