Module: WebGamePresenter

Defined in:
lib/ttt/interfaces/rails/app/presenters/web_game_presenter.rb

Defined Under Namespace

Classes: Base, FourByFour, ThreeByThree, ThreeByThreeByThree

Class Method Summary collapse

Class Method Details

.for(options) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/ttt/interfaces/rails/app/presenters/web_game_presenter.rb', line 2

def self.for(options)
  klass = case options.fetch :board
          when TTT::ThreeByThree        then ThreeByThree
          when TTT::FourByFour          then FourByFour
          when TTT::ThreeByThreeByThree then ThreeByThreeByThree
          else
            raise ArgumentError, "Unknown board: #{board.inspect}"
          end
  klass.new board: options[:board], id: options[:id]
end