lib/mkit/app/controllers/mkitjobs_controller.rb in mkit-0.4.1 vs lib/mkit/app/controllers/mkitjobs_controller.rb in mkit-0.4.2

- old
+ new

@@ -1,9 +1,10 @@ +# frozen_string_literal: true + require 'mkit/app/model/mkit_job' class MkitJobsController < MKIt::Server - # curl localhost:4567/mkitjobs get '/mkitjobs' do JSON.pretty_generate(JSON.parse(MkitJob.all.to_json)) end @@ -22,16 +23,14 @@ delete '/mkitjobs/clean/all' do MkitJob.destroy_all end post '/mkitjobs' do - xx = "no file" + xx = 'no file' if params[:file] tempfile = params[:file][:tempfile] - xx= YAML.load(tempfile.read) + xx = YAML.safe_load(tempfile.read) puts xx end JSON.pretty_generate(JSON.parse(xx.to_json)) end - end -