Skip to content
Browse files

Reduced the number of literal aliases to the range that has actually …

…seen personal use. With the massive savings in overhead, I was able to fit Array#fourty_two
  • Loading branch information...
1 parent 5b72c9b commit 9d8cc60ec3845fa3e6f9292a65b119fe4f619f7e @dhh dhh committed
2 activesupport/CHANGELOG
@@ -64,7 +64,7 @@
* Added TimeZone #=~, to support matching zones by regex in time_zone_select. #195 [Ernie Miller]
-* Added Array#second through Array#tenth as aliases for Array#[1] through Array#[9] [DHH]
+* Added Array#second through Array#fifth as aliases for Array#[1] through Array#[4] + Array#fourty_two as alias for Array[41] [DHH]
* Added test/do declaration style testing to ActiveSupport::TestCase [DHH via Jay Fields]
26 activesupport/lib/active_support/core_ext/array/access.rb
@@ -43,29 +43,9 @@ def fifth
- # Equal to <tt>self[5]</tt>.
- def sixth
- self[5]
- end
- # Equal to <tt>self[6]</tt>.
- def seventh
- self[6]
- end
- # Equal to <tt>self[7]</tt>.
- def eighth
- self[7]
- end
- # Equal to <tt>self[8]</tt>.
- def ninth
- self[8]
- end
- # Equal to <tt>self[9]</tt>.
- def tenth
- self[9]
+ # Equal to <tt>self[41]</tt>. Also known as accessing "the reddit".
+ def fourty_two
+ self[41]
8 activesupport/test/core_ext/array_ext_test.rb
@@ -15,17 +15,13 @@ def test_to
def test_second_through_tenth
- array = (1..10).to_a
+ array = (1..42).to_a
assert_equal array[1], array.second
assert_equal array[2], array.third
assert_equal array[3], array.fourth
assert_equal array[4], array.fifth
- assert_equal array[5], array.sixth
- assert_equal array[6], array.seventh
- assert_equal array[7], array.eighth
- assert_equal array[8], array.ninth
- assert_equal array[9], array.tenth
+ assert_equal array[41], array.fourty_two

39 comments on commit 9d8cc60


Hehe, nice. I wonder what kind of thread this will spawn :-)


Shouldn’t this be called fourty_second?






This is a useful addition. Could you also provide Array#[π] please as I would like to access the 4.14159th element of my arrays but I can’t find a way to. Many thanks


Danish humor :)


You probably want to change it to Array#forty_two


I wish I could unsubscribe from specific github comment thread…


someone got to submit the link first.. heh..


I’d like to propose the following patch:

class Fixnum

alias mult_before_the_answer * def *(other) return 42 if self == 6 && other == 8 mult_before_the_answer(other) end



April 1st already? 8→


rofl …. <3


Please don’t touch second and third d2h! I already use (and love) them in a production app!!!

Best people always go first… :‘( I miss you all sixth..tenth And you, fourtytwo, don’t feel guilty_


Nice, now if we could just find the right array to send this method to…


does that constitute an easter egg or just part of an easter egg shell?


This commit is a joke, right?


I think the “other” people’s republic of Counting (Province of Numbers) rates forty_two as offensive besides all ISO norms: Danger!


This is why you don’t want to run edge rails.


Are the people complaining about Array#forty_two not aware of the cultural reference?


if not, why not


Thanks, David! Finally Rails scales.


lol @ rmoriz


What do you get if you multply six by nine? :)

Ruby on Rails member

@littlestarling: 54.




I don’t like the syntax. For accessing “the Reddit” I’d rather prefer the explicit way:

Reddit::Thread.start do loop do Reddit::Comment.create sleep 1 end end
Ruby on Rails member

Please don’t spoil the joke of revealing the reference :).

Also, this will ship in Rails 2.2. Having this much power should not be available only to edge users.


Yeah, it should be “forty”; one of a multitude of silly linguistic developments in English that makes no sense. I shudder to think what learning English as a second language must be like…


WOOT! Finally!

Brilliant David! Love it!

Ruby on Rails member

It was changed to forty_two in a later commit. And yes, scottymac, it’s a strange exception.


Don’t panic !

(or should I panic ?)


@scottymac languages thrive on exceptions. English is possibly the easiest to learn as second language.


This is Good.


As in Good vs. Evil.

def six_times_nine_if_i_had_thirteen_fingers

@Radar: see “Answer to Life, the Universe and Everything”

Ruby on Rails member

Maybe Merb guys will fix it now! =P


+1 @ianwhite

Please sign in to comment.
Something went wrong with that request. Please try again.