Class: Messaging::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/rdb/messaging.rb

Direct Known Subclasses

Rdb::CommandTarget

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



132
133
134
135
136
137
138
139
140
141
# File 'lib/rdb/messaging.rb', line 132

def initialize
  @connected = false
  @connected_mon = Monitor.new
  @connected_wait = @connected_mon.new_cond

  @result_id = 0
  @result = {}
  @result_mon = {}
  @result_wait = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args, &block) ⇒ Object



152
153
154
# File 'lib/rdb/messaging.rb', line 152

def method_missing(symbol, *args, &block)
  send_message(symbol, args.first || {})
end

Class Method Details

.inherited(klass) ⇒ Object



128
129
130
# File 'lib/rdb/messaging.rb', line 128

def self.inherited(klass)
  klass.send(:extend, RemoteAnnotation)
end

Instance Method Details

#connect_listen(host, port) ⇒ Object



143
144
145
146
147
148
149
150
# File 'lib/rdb/messaging.rb', line 143

def connect_listen(host, port)
  @channel = Cod.tcp("#{host}:#{port}")
  set_connected

  loop do
    process_message
  end
end