Sha256: 2f0acccba717c268a422337f62712df49b8b2912471e152e106fe4959f6b0fc0

Contents?: true

Size: 961 Bytes

Versions: 3

Compression:

Stored size: 961 Bytes

Contents

# frozen string literal: true

require 'dry-initializer'

module SpyAlleyApplication
  module Actions
    class ChooseNewSpyIdentity
      include Dry::Initializer.define -> do
        option :get_new_spy_identity_chosen_node, type: ::Types::Callable, reader: :private
        option :get_result_game_board_node, type: ::Types::Callable, reader: :private
        option :new_spy_identity_chosen, type: ::Types::Callable, reader: :private
        option :process_proceeding_to_next_state, type: ::Types::Callable, reader: :private
      end

      def call(game_board:, change_orders:, nationality:)
        change_orders = change_orders.push(get_new_spy_identity_chosen_node.(
          nationality: nationality))
        game_board = new_spy_identity_chosen.(
          game_board: game_board,
          new_spy_identity: nationality)
        process_proceeding_to_next_state.(game_board: game_board, change_orders: change_orders)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spy_alley_application-0.3.2 lib/spy_alley_application/actions/choose_new_spy_identity.rb
spy_alley_application-0.3.1 lib/spy_alley_application/actions/choose_new_spy_identity.rb
spy_alley_application-0.3.0 lib/spy_alley_application/actions/choose_new_spy_identity.rb