Ruby Hash Map variable. Sinatra: Up and Running game.rb Rock Paper Scissors
I'm following this example in Sinatra: Up and Running example and I get 
the following error message:
>game.rb:8: syntax error, unexpected tSYMBEG, expecting kD0 or '{' or '('<br />
>&nbsp;&nbsp;@defeat = {rock :scissors, paper :rock, scissors :paper}<br />
>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^<br />
game.rb8: syntax error, unexpected tSYMBEG, expecting kD0 or '{' or '('<br />
&nbsp;&nbsp;@defeat = {rock :scissors, paper :rock, scissors :paper}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^<br />


after running:<br />
>$ ruby -rubygems game.rb

However, I have no idea why it has trouble with this statement. I copied the code straight from the book. I've tried many variations and nothing seems to work. This code is suppose to output "Ouch rock beats scissors. Better luck next time!" if I go to localhost:4567/throw/scissors and the computer chooses rock.

game.rb below

    require 'sinatra'
    
    # before we process a route, we'll set the response as
    # plain text and set up an array of viable moves that
    # a player (and the computer) can perform
    before do
      content_type :txt
      @defeat = {rock :scissors, paper :rock, scissors :paper}
      @throws = @defeat.keys
    end
    
    get '/throw/:type' do
      # the params[] hash stores querystring and form data.
      player_throw = params[:type].to_sym
    
      # in the case of a player providing a throw that is not valid,
      # we halt with a status code of 403 (Forbidden) and let them
      # know they need to make a valid throw to play.
      if !@throws.include?(player_throw)
        halt 403, "You must throw one of the following: #{@throws}"
      end
    
      # now we can select a random throw for the computer
      computer_throw = @throws.sample
    
      # compare the player and computer throws to determine a winner
      if player_throw == computer_throw
        "You tied with the computer. Try again!"
      elsif computer_throw == @defeat[player_throw]
        "Nicely done; #{player_throw} beats #{computer_throw}!"
      else
        "Ouch; #{computer_throw} beats #{player_throw}. Better luck next time!"
      end
    end


  [1]: http://i.stack.imgur.com/ln0Y2.png
Ruby Hash Map variable. Sinatra: Up and Running game.rb Rock Paper Scissors
===

I'm following this example in Sinatra: Up and Running example and I get 
the following error message:
>game.rb:8: syntax error, unexpected tSYMBEG, expecting kD0 or '{' or '('<br />
>&nbsp;&nbsp;@defeat = {rock :scissors, paper :rock, scissors :paper}<br />
>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^<br />
game.rb8: syntax error, unexpected tSYMBEG, expecting kD0 or '{' or '('<br />
&nbsp;&nbsp;@defeat = {rock :scissors, paper :rock, scissors :paper}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^<br />


after running:<br />
>$ ruby -rubygems game.rb

However, I have no idea why it has trouble with this statement. I copied the code straight from the book. I've tried many variations and nothing seems to work. This code is suppose to output "Ouch rock beats scissors. Better luck next time!" if I go to localhost:4567/throw/scissors and the computer chooses rock.

game.rb below

    require 'sinatra'
    
    # before we process a route, we'll set the response as
    # plain text and set up an array of viable moves that
    # a player (and the computer) can perform
    before do
      content_type :txt
      @defeat = {rock :scissors, paper :rock, scissors :paper}
      @throws = @defeat.keys
    end
    
    get '/throw/:type' do
      # the params[] hash stores querystring and form data.
      player_throw = params[:type].to_sym
    
      # in the case of a player providing a throw that is not valid,
      # we halt with a status code of 403 (Forbidden) and let them
      # know they need to make a valid throw to play.
      if !@throws.include?(player_throw)
        halt 403, "You must throw one of the following: #{@throws}"
      end
    
      # now we can select a random throw for the computer
      computer_throw = @throws.sample
    
      # compare the player and computer throws to determine a winner
      if player_throw == computer_throw
        "You tied with the computer. Try again!"
      elsif computer_throw == @defeat[player_throw]
        "Nicely done; #{player_throw} beats #{computer_throw}!"
      else
        "Ouch; #{computer_throw} beats #{player_throw}. Better luck next time!"
      end
    end


  [1]: http://i.stack.imgur.com/ln0Y2.png