Class: BitmapCmdEditor::Bitmap
- Inherits:
-
Object
- Object
- BitmapCmdEditor::Bitmap
- Defined in:
- lib/bitmap_cmd_editor/bitmap.rb
Overview
It's the main object is instantiated empty when the application start
Instance Attribute Summary (collapse)
-
- (Object) columns
readonly
Returns the value of attribute columns.
-
- (Object) rows
readonly
Returns the value of attribute rows.
-
- (Object) table
readonly
Returns the value of attribute table.
Instance Method Summary (collapse)
-
- (Bitmap) initialize
constructor
A new instance of Bitmap.
-
- (Object) process_command(input)
process the operations commands availables view the constant COMMANDS, X is excluded because it is a system command not a bitmap command.
Constructor Details
- (Bitmap) initialize
Returns a new instance of Bitmap
9 10 11 12 13 |
# File 'lib/bitmap_cmd_editor/bitmap.rb', line 9 def initialize @table=[] @columns = 0 @rows = 0 end |
Instance Attribute Details
- (Object) columns (readonly)
Returns the value of attribute columns
6 7 8 |
# File 'lib/bitmap_cmd_editor/bitmap.rb', line 6 def columns @columns end |
- (Object) rows (readonly)
Returns the value of attribute rows
6 7 8 |
# File 'lib/bitmap_cmd_editor/bitmap.rb', line 6 def rows @rows end |
- (Object) table (readonly)
Returns the value of attribute table
6 7 8 |
# File 'lib/bitmap_cmd_editor/bitmap.rb', line 6 def table @table end |
Instance Method Details
- (Object) process_command(input)
process the operations commands availables view the constant COMMANDS, X is excluded because it is a system command not a bitmap command
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bitmap_cmd_editor/bitmap.rb', line 19 def process_command(input) validator=Validators::CommandValidator.validate(input) if validator == :valid args = input.split(' ') case args[0] when 'I' create_image(args) when 'C' clear_image(args) when 'L' colours_pixel(args) when 'V' draw_vertical_line(args) when 'H' draw_horizontal_line(args) when 'F' fill_region(args) when 'S' print_table(args) end else validator end end |