Class: URI::Generic

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

Overview

Opal’s stdlib does not implement URI.parse. Rack::Protection calls ‘URI.parse(env).host`. A tiny JS-URL-backed parser is enough to cover that and any equivalent `host`-only usage.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host:, scheme:, port:, path:, query:, fragment:) ⇒ Generic

Returns a new instance of Generic.



301
302
303
304
305
306
307
308
# File 'lib/opal_patches.rb', line 301

def initialize(host:, scheme:, port:, path:, query:, fragment:)
  @host = host
  @scheme = scheme
  @port = port
  @path = path
  @query = query
  @fragment = fragment
end

Instance Attribute Details

#fragmentObject (readonly)

Returns the value of attribute fragment.



299
300
301
# File 'lib/opal_patches.rb', line 299

def fragment
  @fragment
end

#hostObject (readonly)

Returns the value of attribute host.



299
300
301
# File 'lib/opal_patches.rb', line 299

def host
  @host
end

#pathObject (readonly)

Returns the value of attribute path.



299
300
301
# File 'lib/opal_patches.rb', line 299

def path
  @path
end

#portObject (readonly)

Returns the value of attribute port.



299
300
301
# File 'lib/opal_patches.rb', line 299

def port
  @port
end

#queryObject (readonly)

Returns the value of attribute query.



299
300
301
# File 'lib/opal_patches.rb', line 299

def query
  @query
end

#schemeObject (readonly)

Returns the value of attribute scheme.



299
300
301
# File 'lib/opal_patches.rb', line 299

def scheme
  @scheme
end