Class: Riser::UNIXSocketAddress

Inherits:
SocketAddress show all
Defined in:
lib/riser/sockaddr.rb

Instance Attribute Summary collapse

Attributes inherited from SocketAddress

#backlog, #type

Instance Method Summary collapse

Methods inherited from SocketAddress

#==, #eql?, #hash, parse

Constructor Details

#initialize(path, backlog = nil, mode = nil, owner = nil, group = nil) ⇒ UNIXSocketAddress

Returns a new instance of UNIXSocketAddress.



160
161
162
163
164
165
166
# File 'lib/riser/sockaddr.rb', line 160

def initialize(path, backlog=nil, mode=nil, owner=nil, group=nil)
  super(:unix, backlog)
  @path = path
  @mode = mode
  @owner = owner
  @group = group
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



171
172
173
# File 'lib/riser/sockaddr.rb', line 171

def group
  @group
end

#modeObject (readonly)

Returns the value of attribute mode.



169
170
171
# File 'lib/riser/sockaddr.rb', line 169

def mode
  @mode
end

#ownerObject (readonly)

Returns the value of attribute owner.



170
171
172
# File 'lib/riser/sockaddr.rb', line 170

def owner
  @owner
end

#pathObject (readonly)

Returns the value of attribute path.



168
169
170
# File 'lib/riser/sockaddr.rb', line 168

def path
  @path
end

Instance Method Details

#open_serverObject



189
190
191
# File 'lib/riser/sockaddr.rb', line 189

def open_server
  UNIXServer.new(@path)
end

#to_addressObject



173
174
175
# File 'lib/riser/sockaddr.rb', line 173

def to_address
  super << @path
end

#to_optionObject



177
178
179
180
181
182
183
# File 'lib/riser/sockaddr.rb', line 177

def to_option
  option = super
  option[:mode] = @mode if @mode
  option[:owner] = @owner if @owner
  option[:group] = @group if @group
  option
end

#to_sObject



185
186
187
# File 'lib/riser/sockaddr.rb', line 185

def to_s
  "unix:#{@path}"
end