Module: Sinatra::ProcessesHandler
- Extended by:
- Hexacta
- Defined in:
- lib/sinatra/handlers/processes.rb
Constant Summary
Constants included from Hexacta
Instance Method Summary collapse
Methods included from Hexacta
copy_all_files, copy_dir_structure, copy_file, gem_path, setup_dir
Instance Method Details
#enable_processes ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sinatra/handlers/processes.rb', line 6 def enable_processes p "Enabling processes..." get '/processes' do return "" if ProcessManager.instance.find(params[:class]).nil? content_type :json return { 'name' => ProcessManager.instance.find(params[:class]).name, 'progress' => ProcessManager.instance.find(params[:class]).progress }.to_json end post '/processes/:clazz' do |clazz| ProcessManager.instance.clean(clazz) 200 end post '/process' do klass = Object.const_get("#{params[:class]}") a_handler = ProcessManager.instance.run(klass,params) a_handler.to_json end end |