Class: Zadt::Stack
- Inherits:
-
Object
- Object
- Zadt::Stack
- Defined in:
- lib/zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb
Class Method Summary collapse
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #help ⇒ Object
-
#initialize ⇒ Stack
constructor
A new instance of Stack.
- #length ⇒ Object
- #methods ⇒ Object
- #pop ⇒ Object
- #push(val) ⇒ Object
- #show ⇒ Object
Constructor Details
#initialize ⇒ Stack
Returns a new instance of Stack.
3 4 5 |
# File 'lib/zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb', line 3 def initialize @values = Array.new end |
Class Method Details
.help ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb', line 7 def self.help puts "Here are the functions for Stack:" puts "#show" puts "#push(value)" puts "#pop" puts "#length" puts "#empty?" end |
.methods ⇒ Object
16 17 18 |
# File 'lib/zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb', line 16 def self.methods self.help end |
Instance Method Details
#empty? ⇒ Boolean
45 46 47 |
# File 'lib/zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb', line 45 def empty? @values.empty? end |
#help ⇒ Object
20 21 22 |
# File 'lib/zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb', line 20 def help Stack.help end |
#length ⇒ Object
41 42 43 |
# File 'lib/zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb', line 41 def length @values.length end |
#methods ⇒ Object
24 25 26 |
# File 'lib/zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb', line 24 def methods help end |
#pop ⇒ Object
37 38 39 |
# File 'lib/zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb', line 37 def pop @values.pop end |
#push(val) ⇒ Object
32 33 34 35 |
# File 'lib/zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb', line 32 def push(val) @values.push(val) @values end |
#show ⇒ Object
28 29 30 |
# File 'lib/zadt/AbstractDataTypes/MinMaxStackQueue/Stack.rb', line 28 def show @values end |