Skip to content

Instantly share code, notes, and snippets.

@koriroys
Created April 10, 2012 19:07
Show Gist options
  • Save koriroys/2353730 to your computer and use it in GitHub Desktop.
Save koriroys/2353730 to your computer and use it in GitHub Desktop.
Stacks!
class Stack
attr_accessor :stack
def initialize(input)
self.stack = input
end
def pop(*args)
return stack.pop if args.empty?
stack.pop.reverse # This shouldn't work.
end
def push(args)
stack.push(args)
true
end
def to_a
stack
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment