The below code works.  Question though.  How does add_to_stack acess the
@stack instance variable going through the method stack?  In this case
is stack variable looked at as literally the array?

Thanks!  Michael the Ruby Newby:)

------------

module Stacklike

  def stack
    @stack ||=[]
  end

  def add_to_stack(obj)
    stack.push(obj)
  end

end

class Stack
  include Stacklike
end

s = Stack.new

s.add_to_stack("item one")
s.add_to_stack("item two")

puts s.stack

-- 
Posted via http://www.ruby-forum.com/.