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.



320
321
322
323
324
325
326
327
# File 'lib/opal_patches.rb', line 320

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.



318
319
320
# File 'lib/opal_patches.rb', line 318

def fragment
  @fragment
end

#hostObject (readonly)

Returns the value of attribute host.



318
319
320
# File 'lib/opal_patches.rb', line 318

def host
  @host
end

#pathObject (readonly)

Returns the value of attribute path.



318
319
320
# File 'lib/opal_patches.rb', line 318

def path
  @path
end

#portObject (readonly)

Returns the value of attribute port.



318
319
320
# File 'lib/opal_patches.rb', line 318

def port
  @port
end

#queryObject (readonly)

Returns the value of attribute query.



318
319
320
# File 'lib/opal_patches.rb', line 318

def query
  @query
end

#schemeObject (readonly)

Returns the value of attribute scheme.



318
319
320
# File 'lib/opal_patches.rb', line 318

def scheme
  @scheme
end