Method: Bundler::URI::Generic#initialize
- Defined in:
- lib/bundler/vendor/uri/lib/uri/generic.rb
#initialize(scheme, userinfo, host, port, registry, path, opaque, query, fragment, parser = DEFAULT_PARSER, arg_check = false) ⇒ Generic
Args
scheme
-
Protocol scheme, i.e. ‘http’,‘ftp’,‘mailto’ and so on.
userinfo
-
User name and password, i.e. ‘sdmitry:bla’.
host
-
Server host name.
port
-
Server port.
registry
-
Registry of naming authorities.
path
-
Path on server.
opaque
-
Opaque part.
query
-
Query data.
fragment
-
Part of the Bundler::URI after ‘#’ character.
parser
-
Parser for internal use [Bundler::URI::DEFAULT_PARSER by default].
arg_check
-
Check arguments [false by default].
Description
Creates a new Bundler::URI::Generic instance from “generic” components without check.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/bundler/vendor/uri/lib/uri/generic.rb', line 169 def initialize(scheme, userinfo, host, port, registry, path, opaque, query, fragment, parser = DEFAULT_PARSER, arg_check = false) @scheme = nil @user = nil @password = nil @host = nil @port = nil @path = nil @query = nil @opaque = nil @fragment = nil @parser = parser == DEFAULT_PARSER ? nil : parser if arg_check self.scheme = scheme self.userinfo = userinfo self.hostname = host self.port = port self.path = path self.query = query self.opaque = opaque self.fragment = fragment else self.set_scheme(scheme) self.set_userinfo(userinfo) self.set_host(host) self.set_port(port) self.set_path(path) self.query = query self.set_opaque(opaque) self.fragment=(fragment) end if registry raise InvalidURIError, "the scheme #{@scheme} does not accept registry part: #{registry} (or bad hostname?)" end @scheme&.freeze self.set_path('') if !@path && !@opaque # (see RFC2396 Section 5.2) self.set_port(self.default_port) if self.default_port && !@port end |