Class: Kudosu::Printer
- Inherits:
-
Object
- Object
- Kudosu::Printer
- Defined in:
- lib/kudosu/printer.rb
Instance Attribute Summary collapse
-
#board ⇒ Object
Returns the value of attribute board.
Instance Method Summary collapse
-
#initialize(board) ⇒ Printer
constructor
A new instance of Printer.
- #print ⇒ Object
Constructor Details
#initialize(board) ⇒ Printer
Returns a new instance of Printer.
5 6 7 |
# File 'lib/kudosu/printer.rb', line 5 def initialize(board) self.board = board end |
Instance Attribute Details
#board ⇒ Object
Returns the value of attribute board.
3 4 5 |
# File 'lib/kudosu/printer.rb', line 3 def board @board end |
Instance Method Details
#print ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/kudosu/printer.rb', line 9 def print board.rows.each do |row| print_separation puts '| ' + row.map{ |cell| cell.value || " " }.join(' | ') + ' |' end print_separation end |