Class: Cocaine::Locator
- Inherits:
-
AbstractService
- Object
- AbstractService
- Cocaine::Locator
- Defined in:
- lib/cocaine/client/service.rb
Class Attribute Summary collapse
-
.default_host ⇒ Object
Returns the value of attribute default_host.
-
.default_port ⇒ Object
Returns the value of attribute default_port.
Attributes inherited from AbstractService
Instance Method Summary collapse
-
#initialize(host = self.class.default_host, port = self.class.default_port) ⇒ Locator
constructor
A new instance of Locator.
- #resolve(name) ⇒ Object
Methods inherited from AbstractService
Constructor Details
#initialize(host = self.class.default_host, port = self.class.default_port) ⇒ Locator
Returns a new instance of Locator.
70 71 72 73 74 |
# File 'lib/cocaine/client/service.rb', line 70 def initialize(host=self.class.default_host, port=self.class.default_port) @name = 'locator' @host = host @port = port end |
Class Attribute Details
.default_host ⇒ Object
Returns the value of attribute default_host.
67 68 69 |
# File 'lib/cocaine/client/service.rb', line 67 def default_host @default_host end |
.default_port ⇒ Object
Returns the value of attribute default_port.
67 68 69 |
# File 'lib/cocaine/client/service.rb', line 67 def default_port @default_port end |
Instance Method Details
#resolve(name) ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/cocaine/client/service.rb', line 76 def resolve(name) df = EventMachine::DefaultDeferrable.new connect_df = connect_to_endpoint @host, @port connect_df.callback { do_resolve name, df } connect_df.errback { |err| df.fail err } df end |