Class: Jettr::Server::HandlerCollectionProxy
- Inherits:
-
Object
- Object
- Jettr::Server::HandlerCollectionProxy
- Defined in:
- lib/jettr/server.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(server) ⇒ HandlerCollectionProxy
constructor
A new instance of HandlerCollectionProxy.
Constructor Details
#initialize(server) ⇒ HandlerCollectionProxy
Returns a new instance of HandlerCollectionProxy.
112 113 114 115 |
# File 'lib/jettr/server.rb', line 112 def initialize(server) @server = server @handlers = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
122 123 124 125 126 127 128 129 130 |
# File 'lib/jettr/server.rb', line 122 def method_missing(method, *args, &block) handlers_orig = @handlers.clone res = @handlers.send(method, *args, &block) if @handlers != handlers_orig @handlers.flatten! # Ensure the mutation operation didn't introduce nesting. @server.set_handlers(@handlers.to_java(Jettr::Handler::Base)) end return res end |
Class Method Details
.for(server) ⇒ Object
117 118 119 |
# File 'lib/jettr/server.rb', line 117 def self.for(server) self.new(server) end |