Class: Hx::Interop::RPC::Controller
- Inherits:
-
Object
- Object
- Hx::Interop::RPC::Controller
- Defined in:
- lib/interop/rpc/controller.rb
Overview
Abstract class for RPC server controllers.
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Class Method Summary collapse
-
.make_handler(action) ⇒ Object
TODO: hooks, error handlers.
Instance Method Summary collapse
-
#initialize(request) ⇒ Controller
constructor
A new instance of Controller.
- #response ⇒ Object
Constructor Details
#initialize(request) ⇒ Controller
Returns a new instance of Controller.
27 28 29 |
# File 'lib/interop/rpc/controller.rb', line 27 def initialize(request) @request = request end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
25 26 27 |
# File 'lib/interop/rpc/controller.rb', line 25 def request @request end |
Class Method Details
.make_handler(action) ⇒ Object
TODO: hooks, error handlers
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/interop/rpc/controller.rb', line 10 def self.make_handler(action) action = action.to_sym unless public_instance_methods(false).include? action raise ArgumentError, "Invalid action '#{action}' on #{self}" end klass = self lambda do |, | controller = klass.new() controller.__send__ action controller.response end end |