Permalink
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...
dhh committed Nov 21, 2008
1 parent 5b72c9b commit 9d8cc60ec3845fa3e6f9292a65b119fe4f619f7e
View
@@ -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]
@@ -43,29 +43,9 @@ def fifth
self[4]
end
- # 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]
end
end
end
@@ -15,17 +15,13 @@ def test_to
end
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
end
end

39 comments on commit 9d8cc60

@alloy

This comment has been minimized.

Show comment
Hide comment
@alloy

alloy Nov 21, 2008

Contributor

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

Contributor

alloy replied Nov 21, 2008

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

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Nov 21, 2008

Shouldn’t this be called fourty_second?

Shouldn’t this be called fourty_second?

@maseb

This comment has been minimized.

Show comment
Hide comment
@maseb

maseb Nov 21, 2008

Lordy.

Lordy.

@devpopol

This comment has been minimized.

Show comment
Hide comment
@devpopol

devpopol Nov 21, 2008

lol!

lol!

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Nov 21, 2008

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

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

@datra

This comment has been minimized.

Show comment
Hide comment
@datra

datra Nov 21, 2008

Danish humor :)

Danish humor :)

@wtn

This comment has been minimized.

Show comment
Hide comment
@wtn

wtn Nov 21, 2008

You probably want to change it to Array#forty_two

wtn replied Nov 21, 2008

You probably want to change it to Array#forty_two

@ledermann

This comment has been minimized.

Show comment
Hide comment
@ledermann

ledermann Nov 21, 2008

Contributor

I wish I could unsubscribe from specific github comment thread…

Contributor

ledermann replied Nov 21, 2008

I wish I could unsubscribe from specific github comment thread…

@devpopol

This comment has been minimized.

Show comment
Hide comment
@devpopol

devpopol Nov 21, 2008

http://www.reddit.com/r/programming/comments/7erjo/hot_on_the_heels_of_arrayfourth_rails_now_ships/

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

http://www.reddit.com/r/programming/comments/7erjo/hot_on_the_heels_of_arrayfourth_rails_now_ships/

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

@anildigital

This comment has been minimized.

Show comment
Hide comment
@anildigital

anildigital Nov 21, 2008

Contributor

lol

Contributor

anildigital replied Nov 21, 2008

lol

@carllerche

This comment has been minimized.

Show comment
Hide comment
@carllerche

carllerche Nov 21, 2008

Contributor

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

end

Contributor

carllerche replied Nov 21, 2008

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

end

@rmoriz

This comment has been minimized.

Show comment
Hide comment
@rmoriz

rmoriz Nov 21, 2008

April 1st already? 8→

April 1st already? 8→

@hojberg

This comment has been minimized.

Show comment
Hide comment
@hojberg

hojberg Nov 21, 2008

rofl …. <3

rofl …. <3

@elia

This comment has been minimized.

Show comment
Hide comment
@elia

elia Nov 21, 2008

Contributor

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_

Contributor

elia replied Nov 21, 2008

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_

@lackac

This comment has been minimized.

Show comment
Hide comment
@lackac

lackac Nov 21, 2008

Contributor

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

Contributor

lackac replied Nov 21, 2008

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

@monde

This comment has been minimized.

Show comment
Hide comment
@monde

monde Nov 21, 2008

Contributor

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

Contributor

monde replied Nov 21, 2008

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

@Roman2K

This comment has been minimized.

Show comment
Hide comment
@Roman2K

Roman2K Nov 21, 2008

This commit is a joke, right?

This commit is a joke, right?

@rmoriz

This comment has been minimized.

Show comment
Hide comment
@rmoriz

rmoriz Nov 21, 2008

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

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

@datra

This comment has been minimized.

Show comment
Hide comment
@datra

datra Nov 21, 2008

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

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

@unimatrixZxero

This comment has been minimized.

Show comment
Hide comment
@unimatrixZxero

unimatrixZxero Nov 21, 2008

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

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

@neilh

This comment has been minimized.

Show comment
Hide comment
@neilh

neilh Nov 21, 2008

if not, why not

if not, why not

@augustl

This comment has been minimized.

Show comment
Hide comment
@augustl

augustl Nov 21, 2008

Thanks, David! Finally Rails scales.

Thanks, David! Finally Rails scales.

@vesan

This comment has been minimized.

Show comment
Hide comment
@vesan

vesan Nov 21, 2008

Contributor

lol @ rmoriz

Contributor

vesan replied Nov 21, 2008

lol @ rmoriz

@littlestarling

This comment has been minimized.

Show comment
Hide comment
@littlestarling

littlestarling Nov 21, 2008

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

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

@radar

This comment has been minimized.

Show comment
Hide comment
@radar

radar Nov 21, 2008

Contributor

@littlestarling: 54.

Contributor

radar replied Nov 21, 2008

@littlestarling: 54.

@cpjolicoeur

This comment has been minimized.

Show comment
Hide comment
@cpjolicoeur

cpjolicoeur Nov 21, 2008

brilliant

brilliant

@georgi

This comment has been minimized.

Show comment
Hide comment
@georgi

georgi Nov 21, 2008

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

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

@dhh

This comment has been minimized.

Show comment
Hide comment
@dhh

dhh Nov 21, 2008

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.

Member

dhh replied Nov 21, 2008

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.

@scottymac

This comment has been minimized.

Show comment
Hide comment
@scottymac

scottymac Nov 21, 2008

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…

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…

@sw0rdfish

This comment has been minimized.

Show comment
Hide comment
@sw0rdfish

sw0rdfish Nov 21, 2008

WOOT! Finally!

Brilliant David! Love it!

WOOT! Finally!

Brilliant David! Love it!

@dhh

This comment has been minimized.

Show comment
Hide comment
@dhh

dhh Nov 21, 2008

Member

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

Member

dhh replied Nov 21, 2008

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

@virtualmice

This comment has been minimized.

Show comment
Hide comment
@virtualmice

virtualmice Nov 21, 2008

Don’t panic !

(or should I panic ?)

Don’t panic !

(or should I panic ?)

@spiceee

This comment has been minimized.

Show comment
Hide comment
@spiceee

spiceee Nov 21, 2008

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

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

@ncr

This comment has been minimized.

Show comment
Hide comment
@ncr

ncr Nov 22, 2008

Contributor

This is Good.

Contributor

ncr replied Nov 22, 2008

This is Good.

@ncr

This comment has been minimized.

Show comment
Hide comment
@ncr

ncr Nov 22, 2008

Contributor

As in Good vs. Evil.

Contributor

ncr replied Nov 22, 2008

As in Good vs. Evil.

@ianwhite

This comment has been minimized.

Show comment
Hide comment
@ianwhite

ianwhite Nov 22, 2008

Contributor
def six_times_nine_if_i_had_thirteen_fingers
  self[41]
end
Contributor

ianwhite replied Nov 22, 2008

def six_times_nine_if_i_had_thirteen_fingers
  self[41]
end
@littlestarling

This comment has been minimized.

Show comment
Hide comment
@littlestarling

littlestarling Nov 25, 2008

@Radar: see “Answer to Life, the Universe and Everything”
http://tinyurl.com/6kbzkw

@Radar: see “Answer to Life, the Universe and Everything”
http://tinyurl.com/6kbzkw

@josevalim

This comment has been minimized.

Show comment
Hide comment
@josevalim

josevalim Jan 3, 2009

Contributor

Maybe Merb guys will fix it now! =P

Contributor

josevalim replied Jan 3, 2009

Maybe Merb guys will fix it now! =P

@Aupajo

This comment has been minimized.

Show comment
Hide comment
@Aupajo

Aupajo Jan 5, 2009

+1 @ianwhite

+1 @ianwhite

Please sign in to comment.