Sha256: ccb73ba89ac934dbe2f3f4ba25c6e019e81de59d5e5d844fb5d497da965a0fff
Contents?: true
Size: 968 Bytes
Versions: 3
Compression:
Stored size: 968 Bytes
Contents
# frozen_string_literal: true require 'dry-initializer' require 'spy_alley_application/models/game_state/buy_equipment' module SpyAlleyApplication module Results class ProcessBuyEquipmentOptions include Dry::Initializer.define -> do option :get_buy_equipment_option_node, type: ::Types::Callable, reader: :private option :get_next_player_node, type: ::Types::Callable, reader: :private option :get_pass_option_node, type: ::Types::Callable, reader: :private end def call(game_board:, change_orders:) next_player = game_board.players.find{|p| p.seat.eql?(game_board.game_state.seat)} node = SpyAlleyApplication::Models::GameState::BuyEquipment.call(game_board.game_state) change_orders.push(get_next_player_node.(player_id: next_player.id)) .push(get_buy_equipment_node.(options: node.options, limit: node.limit)) .push(get_pass_option_node.()) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems