~pixelinc/gmod-checker.cr

81b1d7ed5877e12880cd54121db5deb61ddf5636 — PixeL 2 months ago fc34cb6
Use case in place of if/elsif
1 files changed, 6 insertions(+), 4 deletions(-)

M src/handlers/socket_handler.cr
M src/handlers/socket_handler.cr => src/handlers/socket_handler.cr +6 -4
@@ 10,21 10,23 @@ class Handlers::SocketHandler
      builder.object do
        builder.field("nonce", nonce.to_s)
        builder.string "type"
        if result.is_a?(Job::PlayerResult)
        case result
        when Job::PlayerResult
          builder.string "player_result"
          builder.string "data"
          result.to_json(builder)
        elsif result.is_a?(Job::BatchPlayers)
        when Job::BatchPlayers
          builder.string "batch_players"
          builder.string "data"
          result.to_json(builder)
        elsif result.is_a?(Job::Error)
        when Job::Error
          builder.string "error"
          builder.field("message", result.message)
          builder.field("data", result.id)
        elsif result.is_a?(Exception)
        when Exception
          builder.string "error"
          builder.field("message", result.message)
        else
        end
      end
    end