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.



324
325
326
327
328
329
330
331
# File 'lib/opal_patches.rb', line 324

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.



322
323
324
# File 'lib/opal_patches.rb', line 322

def fragment
  @fragment
end

#hostObject (readonly)

Returns the value of attribute host.



322
323
324
# File 'lib/opal_patches.rb', line 322

def host
  @host
end

#pathObject (readonly)

Returns the value of attribute path.



322
323
324
# File 'lib/opal_patches.rb', line 322

def path
  @path
end

#portObject (readonly)

Returns the value of attribute port.



322
323
324
# File 'lib/opal_patches.rb', line 322

def port
  @port
end

#queryObject (readonly)

Returns the value of attribute query.



322
323
324
# File 'lib/opal_patches.rb', line 322

def query
  @query
end

#schemeObject (readonly)

Returns the value of attribute scheme.



322
323
324
# File 'lib/opal_patches.rb', line 322

def scheme
  @scheme
end