Class: Bitmapped::Commands::InitialiserCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/bitmapped/commands/initialiser_command.rb

Instance Method Summary collapse

Instance Method Details

#command_idObject



7
8
9
# File 'lib/bitmapped/commands/initialiser_command.rb', line 7

def command_id
  "I"
end

#process_command(bitmap, input) ⇒ Object



11
12
13
14
15
# File 'lib/bitmapped/commands/initialiser_command.rb', line 11

def process_command(bitmap, input)
  Validators::ValidateBitmapSize.parse_and_validate(input)
  bitmap.columns, bitmap.rows = Validators::ValidateColumnRowInput.parse_and_validate(input)
  bitmap.pixels = Array.new(bitmap.rows) { Array.new(bitmap.columns) { "O" } }
end