Class: ChessOpeningsHelper
- Inherits:
-
Object
- Object
- ChessOpeningsHelper
- Defined in:
- lib/chess_openings/chess_openings_helper.rb
Overview
Helper class with utility functions
Class Method Summary collapse
-
.moves_as_strings(moves) ⇒ Array
Transform contents of array to strings.
-
.moves_as_symbols(moves) ⇒ Array
Transform contents of array to symbols.
Class Method Details
.moves_as_strings(moves) ⇒ Array
Transform contents of array to strings
16 17 18 |
# File 'lib/chess_openings/chess_openings_helper.rb', line 16 def self.moves_as_strings(moves) moves.map { |move| move.is_a?(Symbol) ? move.to_s : move } end |
.moves_as_symbols(moves) ⇒ Array
Transform contents of array to symbols
8 9 10 |
# File 'lib/chess_openings/chess_openings_helper.rb', line 8 def self.moves_as_symbols(moves) moves.map { |move| move.is_a?(String) ? move.to_sym : move } end |