Module: Feen::Dumper
- Defined in:
- lib/feen/dumper.rb,
lib/feen/dumper/style_turn.rb,
lib/feen/dumper/pieces_in_hand.rb,
lib/feen/dumper/piece_placement.rb
Overview
Module responsible for converting internal data structures to FEEN notation strings. This implements the serialization part of the FEEN (Forsyth–Edwards Enhanced Notation) format.
Defined Under Namespace
Modules: PiecePlacement, PiecesInHand, StyleTurn
Constant Summary collapse
- FIELD_SEPARATOR =
Field separator used between the three main components of FEEN notation
" "
- ERRORS =
Error messages for validation
{ invalid_piece_placement_type: "Piece placement must be an Array, got %s", invalid_style_turn_type: "Style turn must be an Array with exactly two elements, got %s", invalid_pieces_in_hand_type: "Pieces in hand must be an Array, got %s" }.freeze
Class Method Summary collapse
-
.dump(piece_placement:, pieces_in_hand:, style_turn:) ⇒ String
Converts position components to a complete FEEN string.
Class Method Details
.dump(piece_placement:, pieces_in_hand:, style_turn:) ⇒ String
Converts position components to a complete FEEN string.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/feen/dumper.rb', line 50 def self.dump(piece_placement:, pieces_in_hand:, style_turn:) # Validate input types validate_inputs(piece_placement, style_turn, pieces_in_hand) # Process each component with appropriate submodule and combine into final FEEN string [ PiecePlacement.dump(piece_placement), PiecesInHand.dump(*pieces_in_hand), StyleTurn.dump(*style_turn) ].join(FIELD_SEPARATOR) end |