require 'stack_contract' class Stack contract StackContract class NoPopForEmptyStack < RuntimeError end def initialize @objects = [] end def initialize_copy(orig) @objects = orig.objects end def objects @objects.dup end def size @objects.size end def empty? size == 0 end def top @objects.last end def pop @objects.pop end def push(object) @objects.push(object) nil end end