Class: Uninterruptible::Binder
- Inherits:
-
Object
- Object
- Uninterruptible::Binder
- Defined in:
- lib/uninterruptible/binder.rb
Instance Attribute Summary collapse
-
#bind_uri ⇒ Object
readonly
Returns the value of attribute bind_uri.
Instance Method Summary collapse
-
#bind_to_socket ⇒ TCPServer, UNIXServer
Bind to the TCP or UNIX socket defined in the #bind_uri.
-
#initialize(bind_address) ⇒ Binder
constructor
A new instance of Binder.
Constructor Details
#initialize(bind_address) ⇒ Binder
Returns a new instance of Binder.
11 12 13 |
# File 'lib/uninterruptible/binder.rb', line 11 def initialize(bind_address) @bind_uri = parse_bind_address(bind_address) end |
Instance Attribute Details
#bind_uri ⇒ Object (readonly)
Returns the value of attribute bind_uri.
5 6 7 |
# File 'lib/uninterruptible/binder.rb', line 5 def bind_uri @bind_uri end |
Instance Method Details
#bind_to_socket ⇒ TCPServer, UNIXServer
Bind to the TCP or UNIX socket defined in the #bind_uri
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/uninterruptible/binder.rb', line 20 def bind_to_socket case bind_uri.scheme when 'tcp' bind_to_tcp_socket when 'unix' bind_to_unix_socket else raise Uninterruptible::ConfigurationError, "Can only bind to TCP and UNIX sockets" end end |