Class: Newque::Client
- Inherits:
-
Object
- Object
- Newque::Client
- Extended by:
- Forwardable
- Defined in:
- lib/newque/clients/client.rb
Instance Attribute Summary collapse
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
Instance Method Summary collapse
-
#initialize(protocol, host, port, protocol_options: nil, timeout: 10000) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(protocol, host, port, protocol_options: nil, timeout: 10000) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/newque/clients/client.rb', line 10 def initialize protocol, host, port, protocol_options:nil, timeout:10000 @protocol = protocol @instance = if protocol == :zmq Newque_zmq.new host, port, ( || {}), timeout elsif protocol == :http Newque_http.new host, port, ( || {}), timeout else raise NewqueError.new "Invalid protocol [#{protocol}]. Must be either :zmq or :http" end end |
Instance Attribute Details
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
8 9 10 |
# File 'lib/newque/clients/client.rb', line 8 def protocol @protocol end |