Created
August 16, 2013 06:46
-
-
Save suan/6247795 to your computer and use it in GitHub Desktop.
Revisions
-
suan created this gist
Aug 16, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ class InfiniteArray < Array def initialize(value) super(1, value) end def [](index) self.first end end irb(main):011:0> a = InfiniteArray.new('str') => ["str"] irb(main):012:0> a[999999] => "str" irb(main):013:0> a.first => "str" irb(main):014:0> a.last => "str"