Class: Marty::RpcController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Marty::RpcController
- Defined in:
- app/controllers/marty/rpc_controller.rb
Instance Method Summary collapse
Instance Method Details
#evaluate ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/marty/rpc_controller.rb', line 2 def evaluate res = do_eval(params["script"], params["tag"], params["node"], params["attrs"] || "[]", params["params"] || "{}", params["api_key"] || nil, params["background"], ) respond_to do |format| format.json { send_data res.to_json } format.csv { # SEMI-HACKY: strip outer list if there's only one element. res = res[0] if res.is_a?(Array) && res.length==1 send_data Marty::DataExporter.to_csv(res) } end end |