class ChessOpeningsHelper

Helper class with utility functions

Public Class Methods

moves_as_strings(moves) click to toggle source

Transform contents of array to strings

@param [Array] moves Moves as strings or symbols @return [Array] Array with all moves as strings

# File lib/chess_openings/chess_openings_helper.rb, line 15
def self.moves_as_strings(moves)
  moves.map { |move| move.is_a?(Symbol) ? move.to_s : move }
end
moves_as_symbols(moves) click to toggle source

Transform contents of array to symbols

@param [Array] moves Moves as strings or symbols @return [Array] Array with all moves as symbols

# File lib/chess_openings/chess_openings_helper.rb, line 7
def self.moves_as_symbols(moves)
  moves.map { |move| move.is_a?(String) ? move.to_sym : move }
end