Class: Hanoi::Jane::PaddedStacks
- Inherits:
-
Array
- Object
- Array
- Hanoi::Jane::PaddedStacks
- Defined in:
- lib/hanoi/jane/animation/padded_stacks.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(stacks, height = 7) ⇒ PaddedStacks
constructor
A new instance of PaddedStacks.
Constructor Details
#initialize(stacks, height = 7) ⇒ PaddedStacks
Returns a new instance of PaddedStacks.
4 5 6 7 8 |
# File 'lib/hanoi/jane/animation/padded_stacks.rb', line 4 def initialize stacks, height = 7 stacks.clone.each do |s| self.push PaddedStacks.pad s.clone, height end end |
Class Method Details
.pad(stack, height) ⇒ Object
10 11 12 |
# File 'lib/hanoi/jane/animation/padded_stacks.rb', line 10 def PaddedStacks.pad stack, height stack + Array.new(height - stack.length) end |