Class: CompassAeConsole::ErpApp::Desktop::BaseController
- Inherits:
-
ErpApp::Desktop::BaseController
- Object
- ErpApp::Desktop::BaseController
- CompassAeConsole::ErpApp::Desktop::BaseController
- Defined in:
- app/controllers/compass_ae_console/erp_app/desktop/base_controller.rb
Instance Method Summary collapse
Instance Method Details
#command ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/compass_ae_console/erp_app/desktop/base_controller.rb', line 5 def command begin result = "" # NOTE- the console uses a shared binding. this is due to the fact # that binding instances are not serializable and cant be stored # in a user session. Until this is resolved we use a global var. # this should not pose a problem as the console should only be used # in development or by a sysadmin. # the shared binding is needed to allow for variable scope visibility # across multiple requests if ($session_binding==nil) $session_binding=binding end =params[:command_message] # here we handle any desktop console-specific command # these can include non-eval related funtions # or provide shortcuts to common eval expressions result = case when /^-help/ when /^-clear/ #this is handled in the console desktop application when /^-time/ evaluate_command("Time.now") when /^-whoami/ evaluate_command("current_user.username") else evaluate_command() end = result.to_s.gsub("\n", "<br />\n") render :json => {:success => "#{}<hr><br>"} end end |