1: class Stack 2: def initialize 3: @items = Array.new 4: @depth = 0 5: end 6: def depth 7: @depth 8: end 9: # ... other methods 10: end
1: class Stack 2: def initialize 3: @items = Array.new 4: @depth = 0 5: end 6: attr_reader :depth 7: # ... other methods 8: end