Class: ReverseProxy::Proxy::Generic
- Inherits:
-
Object
- Object
- ReverseProxy::Proxy::Generic
- Defined in:
- lib/reverse_proxy/proxy/generic.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.events ⇒ Object
readonly
Returns the value of attribute events.
Instance Attribute Summary collapse
-
#application ⇒ Object
Returns the value of attribute application.
-
#binds ⇒ Object
Returns the value of attribute binds.
-
#config ⇒ Object
Returns the value of attribute config.
-
#lock ⇒ Object
readonly
Returns the value of attribute lock.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#server ⇒ Object
Returns the value of attribute server.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(params = {}) ⇒ Generic
constructor
A new instance of Generic.
- #log(message) ⇒ Object
- #reload ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Generic
Returns a new instance of Generic.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 26 def initialize params={} ReverseProxy.instance = self @pid = Process.pid @lock ||= Mutex.new @server = ReverseProxy::Server.const_get(params[:server]).new self @binds ||= Set.new @application = Application.new self @config ||= Config.for self prepare on_initialize end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
63 64 65 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 63 def method_missing method, *args, &block self.send(:server_event, method) if method.to_s =~ /^(on|before|after)_/ end |
Class Attribute Details
.events ⇒ Object (readonly)
Returns the value of attribute events.
8 9 10 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 8 def events @events end |
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
24 25 26 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 24 def application @application end |
#binds ⇒ Object
Returns the value of attribute binds.
24 25 26 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 24 def binds @binds end |
#config ⇒ Object
Returns the value of attribute config.
24 25 26 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 24 def config @config end |
#lock ⇒ Object (readonly)
Returns the value of attribute lock.
23 24 25 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 23 def lock @lock end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
23 24 25 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 23 def pid @pid end |
#server ⇒ Object
Returns the value of attribute server.
24 25 26 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 24 def server @server end |
Instance Method Details
#id ⇒ Object
40 41 42 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 40 def id ReverseProxy::Proxy.id end |
#log(message) ⇒ Object
37 38 39 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 37 def log puts "[#{pid}] #{}" end |
#reload ⇒ Object
49 50 51 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 49 def reload @reload.call end |
#start ⇒ Object
43 44 45 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 43 def start @start.call end |
#stop ⇒ Object
46 47 48 |
# File 'lib/reverse_proxy/proxy/generic.rb', line 46 def stop @stop.call end |