Class: LogStashLogger::Device::Socket

Inherits:
Connectable show all
Defined in:
lib/logstash-logger/device/socket.rb

Direct Known Subclasses

TCP, UDP

Constant Summary collapse

DEFAULT_HOST =
'0.0.0.0'

Instance Attribute Summary collapse

Attributes inherited from Base

#io, #sync

Instance Method Summary collapse

Methods inherited from Connectable

#connected?, #flush, #to_io, #write

Methods inherited from Base

#close, #flush, #to_io, #write

Constructor Details

#initialize(opts) ⇒ Socket

Returns a new instance of Socket.



10
11
12
13
14
# File 'lib/logstash-logger/device/socket.rb', line 10

def initialize(opts)
  super
  @port = opts[:port] || fail(ArgumentError, "Port is required")
  @host = opts[:host] || DEFAULT_HOST
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



8
9
10
# File 'lib/logstash-logger/device/socket.rb', line 8

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



8
9
10
# File 'lib/logstash-logger/device/socket.rb', line 8

def port
  @port
end