diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-06-17 13:37:57 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-06-17 17:37:29 -0500 |
commit | 22af62cf486721ee2e45bb720c42ac2f4121faf4 (patch) | |
tree | 155c0f6bb42effe927953956140b7b1243f7e05c /activesupport/lib/active_support | |
parent | 7650ff892cbffcaaaf9c5ab72466e98903a202d3 (diff) | |
download | rails-22af62cf486721ee2e45bb720c42ac2f4121faf4.tar.gz rails-22af62cf486721ee2e45bb720c42ac2f4121faf4.tar.bz2 rails-22af62cf486721ee2e45bb720c42ac2f4121faf4.zip |
Added Array#second through Array#tenth as aliases for Array#[1] through Array#[9] [DHH]
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/access.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/access.rb b/activesupport/lib/active_support/core_ext/array/access.rb index 21a8584bb9..4ac95efdc7 100644 --- a/activesupport/lib/active_support/core_ext/array/access.rb +++ b/activesupport/lib/active_support/core_ext/array/access.rb @@ -20,6 +20,51 @@ module ActiveSupport #:nodoc: def to(position) self[0..position] end + + # Equal to self[1] + def second + self[1] + end + + # Equal to self[2] + def third + self[2] + end + + # Equal to self[3] + def fourth + self[3] + end + + # Equal to self[4] + def fifth + self[4] + end + + # Equal to self[5] + def sixth + self[5] + end + + # Equal to self[6] + def seventh + self[6] + end + + # Equal to self[7] + def eighth + self[7] + end + + # Equal to self[8] + def ninth + self[8] + end + + # Equal to self[9] + def tenth + self[9] + end end end end |