Class: Rox::Core::CoreStack
- Inherits:
-
Object
- Object
- Rox::Core::CoreStack
- Defined in:
- lib/rox/core/roxx/core_stack.rb
Instance Method Summary collapse
-
#initialize ⇒ CoreStack
constructor
A new instance of CoreStack.
- #peek ⇒ Object
- #pop ⇒ Object
- #push(item) ⇒ Object
Constructor Details
#initialize ⇒ CoreStack
Returns a new instance of CoreStack.
4 5 6 |
# File 'lib/rox/core/roxx/core_stack.rb', line 4 def initialize @items = [] end |
Instance Method Details
#peek ⇒ Object
17 18 19 |
# File 'lib/rox/core/roxx/core_stack.rb', line 17 def peek @items[-1] end |
#pop ⇒ Object
13 14 15 |
# File 'lib/rox/core/roxx/core_stack.rb', line 13 def pop @items.pop end |
#push(item) ⇒ Object
8 9 10 11 |
# File 'lib/rox/core/roxx/core_stack.rb', line 8 def push(item) @items << item nil end |