Skip to content

Instantly share code, notes, and snippets.

@wesmaldonado
Created May 5, 2009 18:27
Show Gist options
  • Save wesmaldonado/107108 to your computer and use it in GitHub Desktop.
Save wesmaldonado/107108 to your computer and use it in GitHub Desktop.
class PushIt
def initialize
@whatsits = []
end
def <<(*args)
@whatsits << args
end
def count
@whatsits.size
end
def size
@whatsits.size
end
end
pi = PushIt.new
# => #<PushIt:0x1133fc0 @whatsits=[]>
pi << 1
#=> [[1]]
pi << 2
#=> [[1], [2]]
pi << 3
#=> [[1], [2], [3]]
>> pi.size
# => 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment