Class: MelissaData::Client::TCP
- Inherits:
-
Base
- Object
- Base
- MelissaData::Client::TCP
show all
- Defined in:
- lib/melissadata/client/tcp.rb
Instance Attribute Summary
Attributes inherited from Base
#rpc
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#process, #process_address, #process_email, #process_geo, #process_ip, #process_name, #process_phone, #version
Constructor Details
#initialize(host = self.class.host, port = self.class.port) ⇒ TCP
Returns a new instance of TCP.
21
22
23
24
25
|
# File 'lib/melissadata/client/tcp.rb', line 21
def initialize(host=self.class.host, port=self.class.port)
@host = host
@port = port
@rpc = MessagePack::RPC::Client.new(@host, @port)
end
|
Class Method Details
.available? ⇒ Boolean
5
6
7
8
9
10
|
# File 'lib/melissadata/client/tcp.rb', line 5
def available?
TCPSocket.new(host, port)
true
rescue Errno::ECONNREFUSED
false
end
|
.host ⇒ Object
12
13
14
|
# File 'lib/melissadata/client/tcp.rb', line 12
def host
'127.0.0.1'
end
|