Sha256: ea239112e7ba6edb2739d78a70e0af917d6a1063d2cd19d645ff1b20bd143b66

Contents?: true

Size: 918 Bytes

Versions: 3

Compression:

Stored size: 918 Bytes

Contents

# frozen string literal: true

require 'dry-struct'
require 'spy_alley_application/models/game_state/victory_reason/by_elimination'
require 'spy_alley_application/models/game_state/victory_reason/by_embassy'
require 'spy_alley_application/types/coercible_integer_one_to_six'

module SpyAlleyApplication
  module Models
    module GameState
      class GameOver < Dry::Struct
        @@can_handle_game_over = ::Types.Interface(:handle_game_over)

        attribute :name, ::Types::Value('game_over')
        attribute :seat, SpyAlleyApplication::Types::CoercibleIntegerOneToSix
        attribute :reason, SpyAlleyApplication::Models::GameState::VictoryReason::ByElimination |
          SpyAlleyApplication::Models::GameState::VictoryReason::ByEmbassy

        def accept(visitor, **args)
          @@can_handle_game_over.(visitor)
          visitor.handle_game_over(self, args)
        end
      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/models/game_state/game_over.rb
spy_alley_application-0.3.1 lib/spy_alley_application/models/game_state/game_over.rb
spy_alley_application-0.3.0 lib/spy_alley_application/models/game_state/game_over.rb