Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add examples for array access methods

  • Loading branch information...
commit 98b700e0bfe836c7ee4754344202dd15c7ee0f2c 1 parent eac264d
@vijaydev vijaydev authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 railties/guides/source/active_support_core_extensions.textile
View
5 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
Please sign in to comment.
Something went wrong with that request. Please try again.