Class: MailChess::Piece::Queen
- Defined in:
- lib/mail_chess/pieces/queen.rb
Overview
Represents a queen chess piece.
Instance Attribute Summary
Attributes inherited from Piece
#board, #color, #html, #id, #type
Class Method Summary collapse
-
.new!(db, board, position, color) ⇒ Object
Overwrite superclass method.
Instance Method Summary collapse
-
#initialize(db, piece_id, board = nil) ⇒ Queen
constructor
Calls the superclass.
Methods inherited from Piece
create_tables, #delete!, load!, need_to_create_tables?, #position, #save!
Constructor Details
#initialize(db, piece_id, board = nil) ⇒ Queen
Calls the superclass.
11 12 13 14 15 |
# File 'lib/mail_chess/pieces/queen.rb', line 11 def initialize db, piece_id, board = nil super db, piece_id, board @html = @color == :white ? '♕' : '♛' end |
Class Method Details
.new!(db, board, position, color) ⇒ Object
Overwrite superclass method.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mail_chess/pieces/queen.rb', line 18 def self.new! db, board, position, color super db, board, position, color id = db[:pieces].insert(:type => 'queen', :color => color.to_s, :position => position, :board_id => board.id) return Queen.new db, id, board end |