Class: Bundler::SocketAddress

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/mirror.rb

Overview

Socket address builder.

Given a socket type, a host and a port,

provides a method to build sockaddr string

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, host, port) ⇒ SocketAddress

Returns a new instance of SocketAddress.



213
214
215
216
217
# File 'lib/bundler/mirror.rb', line 213

def initialize(type, host, port)
  @type = type
  @host = host
  @port = port
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



211
212
213
# File 'lib/bundler/mirror.rb', line 211

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



211
212
213
# File 'lib/bundler/mirror.rb', line 211

def port
  @port
end

#typeObject (readonly)

Returns the value of attribute type.



211
212
213
# File 'lib/bundler/mirror.rb', line 211

def type
  @type
end

Instance Method Details

#to_socket_addressObject



219
220
221
# File 'lib/bundler/mirror.rb', line 219

def to_socket_address
  Socket.pack_sockaddr_in(@port, @host)
end