Class: UU::OS::VUC::FormController
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- UU::OS::VUC::FormController
- Defined in:
- uu_adk-0.28.16/lib/uu/os/vuc/form_controller.rb
Overview
Ancestor for development of custom form controllers. All controllers should define only event handling methods.
Instance Method Summary (collapse)
-
- (FormController) initialize
constructor
Creates new instance of FormController.
Constructor Details
- (FormController) initialize
Creates new instance of FormController.
61 62 63 64 |
# File 'uu_adk-0.28.16/lib/uu/os/vuc/form_controller.rb', line 61 def initialize super @log = UU::OS::Logger.new(self.class) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(method, *args, &block)
Controller need not to implement all possible event methods. This method provides default behavior of all unimplemented events.
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'uu_adk-0.28.16/lib/uu/os/vuc/form_controller.rb', line 70 def method_missing(method, *args, &block) view = args[0] # Do not touch view in case of unimplemented event with exception # of submit event which must be always implemented. if (method == :on_submit) raise "Controller #{self.class} does not define on_submit method." elsif (method.to_s[/^on_/] == nil) || (args.size != 1) # Invoked method was not "event" method with view parameter - throw regular method missing exception. raise NameError.new("undefined local variable or method '#{method.to_s}' for #{self.class}") end return HTTPStatus::OK end |