class Sashite::PAN::Parser

Parser class

Public Class Methods

call(serialized_move) click to toggle source
# File lib/sashite/pan/parser.rb, line 9
def self.call(serialized_move)
  serialized_move.split(separator)
                 .map { |serialized_action| new(serialized_action).call }
end
new(serialized_action) click to toggle source
Calls superclass method
# File lib/sashite/pan/parser.rb, line 14
def initialize(serialized_action)
  super()

  action_args = serialized_action.split(separator)
  src_square  = action_args.fetch(0)
  @src_square = src_square.eql?(drop_char) ? nil : Integer(src_square)
  @dst_square = Integer(action_args.fetch(1))
  @piece_name = action_args.fetch(2)
  @piece_hand = action_args.fetch(3, nil)
end

Public Instance Methods

call() click to toggle source
# File lib/sashite/pan/parser.rb, line 25
def call
  [src_square, dst_square, piece_name, piece_hand]
end