Class: Sashite::PAN::Dumper

Inherits:
Action
  • Object
show all
Defined in:
lib/sashite/pan/dumper.rb

Overview

Dumper class

Instance Attribute Summary

Attributes inherited from Action

#dst_square, #piece_hand, #piece_name, #src_square

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(src_square, dst_square, piece_name, piece_hand = nil) ⇒ Dumper

Returns a new instance of Dumper.



14
15
16
17
18
19
20
21
# File 'lib/sashite/pan/dumper.rb', line 14

def initialize(src_square, dst_square, piece_name, piece_hand = nil)
  super()

  @src_square = src_square.nil? ? drop_char : Integer(src_square)
  @dst_square = Integer(dst_square)
  @piece_name = piece_name.to_s
  @piece_hand = piece_hand&.to_s
end

Class Method Details

.call(*actions) ⇒ Object



9
10
11
12
# File 'lib/sashite/pan/dumper.rb', line 9

def self.call(*actions)
  actions.map { |action_items| new(*action_items).call }
         .join(separator)
end

Instance Method Details

#callObject



23
24
25
# File 'lib/sashite/pan/dumper.rb', line 23

def call
  action_items.join(separator)
end