Sha256: 3649082a8530a39a8af427098bf8dbed350d4741983dc52f1207be3368b543cf

Contents?: true

Size: 483 Bytes

Versions: 1

Compression:

Stored size: 483 Bytes

Contents

require 'bitmapped/commands/base_command'

module Bitmapped
  module Commands
    class InitialiserCommand < BaseCommand

      def command_id
        "I"
      end

      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitmapped-0.2.0 lib/bitmapped/commands/initialiser_command.rb