Class: EM::Nodes::Client

Inherits:
Connection
  • Object
show all
Includes:
Commands, P::ObjectProtocol
Defined in:
lib/em-nodes/client/hello.rb,
lib/em-nodes/client/task.rb,
lib/em-nodes/client.rb

Direct Known Subclasses

DefaultClient

Defined Under Namespace

Modules: HelloFeature, TaskFeature

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aliveObject (readonly)

Returns the value of attribute alive.



8
9
10
# File 'lib/em-nodes/client.rb', line 8

def alive
  @alive
end

Class Method Details

.connect(host, port = nil, *args, &block) ⇒ Object



19
20
21
22
# File 'lib/em-nodes/client.rb', line 19

def self.connect(host, port = nil, *args, &block)
  EM::Nodes.logger.info { "Connecting to server #{host}#{port ? ':' + port.to_s : nil}" }
  EM.connect(host, port, self, *args)
end

Instance Method Details

#post_initObject



10
11
12
# File 'lib/em-nodes/client.rb', line 10

def post_init
  @alive = true
end

#unbindObject



14
15
16
17
# File 'lib/em-nodes/client.rb', line 14

def unbind
  @alive = false
  EM::Nodes.logger.warn { "Connection has terminated" }
end