Class: Cuca::Sandbox

Inherits:
Object
  • Object
show all
Defined in:
lib/cuca/app.rb

Overview

Sandbox is used internally run the action script defined by the controller In future this can be extended to implement some security features etc..

Class Method Summary collapse

Class Method Details

.run(controller_class_name, mod, assigns, request_method, subcall) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cuca/app.rb', line 19

def self.run(controller_class_name, mod, assigns, request_method, subcall)
  self.class.send(:include, mod)
  controller_class = mod::const_get(controller_class_name)
  controller = controller_class.send(:new, :assigns=>assigns)
  controller.run_before_filters


  controller.send('_do'.intern, 'run', subcall)
  case request_method
      when 'POST' 
           controller.send('_do'.intern, 'post', subcall)
      when 'GET' 
           controller.send('_do'.intern, 'get', subcall)
  end

  controller.run_after_filters

  return [controller.http_status, controller.mime_type, controller.to_s]
end