class URI::Navigation
Constants
- COMPONENT
- DEFAULT_PORT
Attributes
to[R]
Public Class Methods
new(*arg)
click to toggle source
Calls superclass method
# File lib/uri/navigation.rb, line 8 def initialize(*arg) super(*arg) to, query = @opaque.split('?', 2) @to = to self.query = query end
Public Instance Methods
queries()
click to toggle source
# File lib/uri/navigation.rb, line 30 def queries @query.split('&').map { |x| x.split(/=/, 2) }.to_h end
query=(v)
click to toggle source
# File lib/uri/navigation.rb, line 17 def query=(v) return @query = nil unless v x = v.to_str v = x.dup if x.equal? v v.encode!(Encoding::UTF_8) rescue nil v.delete!("\t\r\n") v.force_encoding(Encoding::ASCII_8BIT) v.gsub!(/(?!%\h\h|[!$-&(-;=?-_a-~])./n.freeze){'%%%02X' % $&.ord} v.force_encoding(Encoding::US_ASCII) @query = v end
to_s()
click to toggle source
# File lib/uri/navigation.rb, line 34 def to_s "#{@scheme}:#{@to}" + (@query && !@query.empty? ? "?#{@query}" : '') end