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.



127
128
129
130
131
132
133
# File 'lib/riser/sockaddr.rb', line 127

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.



138
139
140
# File 'lib/riser/sockaddr.rb', line 138

def group
  @group
end

#modeObject (readonly)

Returns the value of attribute mode.



136
137
138
# File 'lib/riser/sockaddr.rb', line 136

def mode
  @mode
end

#ownerObject (readonly)

Returns the value of attribute owner.



137
138
139
# File 'lib/riser/sockaddr.rb', line 137

def owner
  @owner
end

#pathObject (readonly)

Returns the value of attribute path.



135
136
137
# File 'lib/riser/sockaddr.rb', line 135

def path
  @path
end

Instance Method Details

#open_serverObject



156
157
158
# File 'lib/riser/sockaddr.rb', line 156

def open_server
  UNIXServer.new(@path)
end

#to_addressObject



140
141
142
# File 'lib/riser/sockaddr.rb', line 140

def to_address
  super << @path
end

#to_optionObject



144
145
146
147
148
149
150
# File 'lib/riser/sockaddr.rb', line 144

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

#to_sObject



152
153
154
# File 'lib/riser/sockaddr.rb', line 152

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