Class: Idecoder::RunnersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/idecoder/runners_controller.rb

Instance Method Summary collapse

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/idecoder/runners_controller.rb', line 14

def run
  begin
    fabrica = RunFactory.for(params['mode'])
    parser = CodeParser.new(params['code'], fabrica)

    data = parser.parse
    render json: {data: data, status: 200}, status: :ok
  rescue Exception => ex
    render json: {data: ex.message, status: 500}, status: :ok
  end
end

#testObject



8
9
10
11
12
# File 'app/controllers/idecoder/runners_controller.rb', line 8

def test
  @modes = RunFactory.list_types
  @mode = params['mode'] || "ruby"
  render layout: false
end