Class: Arpoon::Client
- Inherits:
-
Object
show all
- Defined in:
- lib/arpoon/client.rb
Instance Method Summary
collapse
Constructor Details
#initialize(path = '/var/run/arpoon.ctl') ⇒ Client
Returns a new instance of Client.
17
18
19
|
# File 'lib/arpoon/client.rb', line 17
def initialize (path = '/var/run/arpoon.ctl')
@socket = UNIXSocket.new(File.expand_path(path))
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
25
26
27
|
# File 'lib/arpoon/client.rb', line 25
def method_missing (*args, &block)
@socket.__send__ *args, &block
end
|
Instance Method Details
#read_response ⇒ Object
33
34
35
|
# File 'lib/arpoon/client.rb', line 33
def read_response
JSON.parse(?[ + self.readline + ?]).first
end
|
#respond_to_missing?(*args) ⇒ Boolean
21
22
23
|
# File 'lib/arpoon/client.rb', line 21
def respond_to_missing? (*args)
@socket.respond_to? *args
end
|
#send_request(name, *args) ⇒ Object
29
30
31
|
# File 'lib/arpoon/client.rb', line 29
def send_request (name, *args)
self.puts [name, args].to_json
end
|