Class: LogStashLogger::Device::TCP
- Inherits:
-
Socket
- Object
- Base
- Connectable
- Socket
- LogStashLogger::Device::TCP
- Defined in:
- lib/logstash-logger/device/tcp.rb
Constant Summary
Constants inherited from Socket
Instance Attribute Summary collapse
-
#ssl_certificate ⇒ Object
readonly
Returns the value of attribute ssl_certificate.
Attributes inherited from Socket
Attributes inherited from Base
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(opts) ⇒ TCP
constructor
A new instance of TCP.
- #use_ssl? ⇒ Boolean
Methods inherited from Connectable
#close, #connected?, #flush, #reconnect, #to_io, #with_connection, #write, #write_batch
Methods inherited from Base
#close, #flush, #to_io, #write
Constructor Details
#initialize(opts) ⇒ TCP
Returns a new instance of TCP.
8 9 10 11 12 13 |
# File 'lib/logstash-logger/device/tcp.rb', line 8 def initialize(opts) super @ssl_certificate = opts[:ssl_certificate] @use_ssl = !!(@ssl_certificate || opts[:use_ssl] || opts[:ssl_enable]) end |
Instance Attribute Details
#ssl_certificate ⇒ Object (readonly)
Returns the value of attribute ssl_certificate.
6 7 8 |
# File 'lib/logstash-logger/device/tcp.rb', line 6 def ssl_certificate @ssl_certificate end |
Instance Method Details
#connect ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/logstash-logger/device/tcp.rb', line 19 def connect if use_ssl? ssl_connect else non_ssl_connect end @io end |
#use_ssl? ⇒ Boolean
15 16 17 |
# File 'lib/logstash-logger/device/tcp.rb', line 15 def use_ssl? @use_ssl || !@ssl_certificate.nil? end |