# typed: true # DO NOT EDIT MANUALLY # This is an autogenerated file for types exported from the `addressable` gem. # Please instead update this file by running `bin/tapioca gem addressable`. # Addressable is a library for processing links and URIs. # # source://addressable//lib/addressable/version.rb#22 module Addressable; end # source://addressable//lib/addressable/idna/pure.rb#21 module Addressable::IDNA class << self # source://addressable//lib/addressable/idna/pure.rb#117 def _deprecated_unicode_normalize_kc(value); end # Converts from a Unicode internationalized domain name to an ASCII # domain name as described in RFC 3490. # # source://addressable//lib/addressable/idna/pure.rb#67 def to_ascii(input); end # Converts from an ASCII domain name to a Unicode internationalized # domain name as described in RFC 3490. # # source://addressable//lib/addressable/idna/pure.rb#93 def to_unicode(input); end # @deprecated Use {String#unicode_normalize(:nfkc)} instead def unicode_normalize_kc(*args, **_arg1, &block); end private # source://addressable//lib/addressable/idna/pure.rb#140 def lookup_unicode_lowercase(codepoint); end # Bias adaptation method # # source://addressable//lib/addressable/idna/pure.rb#488 def punycode_adapt(delta, numpoints, firsttime); end # @return [Boolean] # # source://addressable//lib/addressable/idna/pure.rb#456 def punycode_basic?(codepoint); end # source://addressable//lib/addressable/idna/pure.rb#334 def punycode_decode(punycode); end # Returns the numeric value of a basic codepoint # (for use in representing integers) in the range 0 to # base - 1, or PUNYCODE_BASE if codepoint does not represent a value. # # source://addressable//lib/addressable/idna/pure.rb#474 def punycode_decode_digit(codepoint); end # @return [Boolean] # # source://addressable//lib/addressable/idna/pure.rb#461 def punycode_delimiter?(codepoint); end # source://addressable//lib/addressable/idna/pure.rb#213 def punycode_encode(unicode); end # source://addressable//lib/addressable/idna/pure.rb#466 def punycode_encode_digit(d); end # Unicode aware downcase method. # # @api private # @param input [String] The input string. # @return [String] The downcased result. # # source://addressable//lib/addressable/idna/pure.rb#132 def unicode_downcase(input); end end end # source://addressable//lib/addressable/idna/pure.rb#183 Addressable::IDNA::ACE_MAX_LENGTH = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#40 Addressable::IDNA::ACE_PREFIX = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/idna/pure.rb#172 Addressable::IDNA::COMPOSITION_TABLE = T.let(T.unsafe(nil), Hash) # source://addressable//lib/addressable/idna/pure.rb#185 Addressable::IDNA::PUNYCODE_BASE = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#189 Addressable::IDNA::PUNYCODE_DAMP = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#192 Addressable::IDNA::PUNYCODE_DELIMITER = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#190 Addressable::IDNA::PUNYCODE_INITIAL_BIAS = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#191 Addressable::IDNA::PUNYCODE_INITIAL_N = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#194 Addressable::IDNA::PUNYCODE_MAXINT = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#196 Addressable::IDNA::PUNYCODE_PRINT_ASCII = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/idna/pure.rb#188 Addressable::IDNA::PUNYCODE_SKEW = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#187 Addressable::IDNA::PUNYCODE_TMAX = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#186 Addressable::IDNA::PUNYCODE_TMIN = T.let(T.unsafe(nil), Integer) # Input is invalid. # # source://addressable//lib/addressable/idna/pure.rb#207 class Addressable::IDNA::PunycodeBadInput < ::StandardError; end # Output would exceed the space provided. # # source://addressable//lib/addressable/idna/pure.rb#209 class Addressable::IDNA::PunycodeBigOutput < ::StandardError; end # Input needs wider integers to process. # # source://addressable//lib/addressable/idna/pure.rb#211 class Addressable::IDNA::PunycodeOverflow < ::StandardError; end # source://addressable//lib/addressable/idna/pure.rb#163 Addressable::IDNA::UNICODE_DATA = T.let(T.unsafe(nil), Hash) # source://addressable//lib/addressable/idna/pure.rb#150 Addressable::IDNA::UNICODE_DATA_CANONICAL = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#148 Addressable::IDNA::UNICODE_DATA_COMBINING_CLASS = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#151 Addressable::IDNA::UNICODE_DATA_COMPATIBILITY = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#149 Addressable::IDNA::UNICODE_DATA_EXCLUSION = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#153 Addressable::IDNA::UNICODE_DATA_LOWERCASE = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#154 Addressable::IDNA::UNICODE_DATA_TITLECASE = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#152 Addressable::IDNA::UNICODE_DATA_UPPERCASE = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#182 Addressable::IDNA::UNICODE_MAX_LENGTH = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/idna/pure.rb#36 Addressable::IDNA::UNICODE_TABLE = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/idna/pure.rb#42 Addressable::IDNA::UTF8_REGEX = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/idna/pure.rb#53 Addressable::IDNA::UTF8_REGEX_MULTIBYTE = T.let(T.unsafe(nil), Regexp) # This is an implementation of a URI template based on # RFC 6570 (http://tools.ietf.org/html/rfc6570). # # source://addressable//lib/addressable/template.rb#27 class Addressable::Template # Creates a new Addressable::Template object. # # @param pattern [#to_str] The URI Template pattern. # @return [Addressable::Template] The initialized Template object. # # source://addressable//lib/addressable/template.rb#234 def initialize(pattern); end # Returns true if the Template objects are equal. This method # does NOT normalize either Template before doing the comparison. # # @param template [Object] The Template to compare. # @return [TrueClass, FalseClass] true if the Templates are equivalent, false # otherwise. # # source://addressable//lib/addressable/template.rb#274 def ==(template); end # Returns true if the Template objects are equal. This method # does NOT normalize either Template before doing the comparison. # Addressable::Template makes no distinction between `==` and `eql?`. # # @param template [Object] The Template to compare. # @return [TrueClass, FalseClass] true if the Templates are equivalent, false # otherwise. # @see #== # # source://addressable//lib/addressable/template.rb#274 def eql?(template); end # Expands a URI template into a full URI. # # The object should respond to either the validate or # transform messages or both. Both the validate and # transform methods should take two parameters: name and # value. The validate method should return true # or false; true if the value of the variable is valid, # false otherwise. An InvalidTemplateValueError # exception will be raised if the value is invalid. The transform # method should return the transformed variable value as a String. # If a transform method is used, the value will not be percent # encoded automatically. Unicode normalization will be performed both # before and after sending the value to the transform method. # # @example # class ExampleProcessor # def self.validate(name, value) # return !!(value =~ /^[\w ]+$/) if name == "query" # return true # end # # def self.transform(name, value) # return value.gsub(/ /, "+") if name == "query" # return value # end # end # # Addressable::Template.new( # "http://example.com/search/{query}/" # ).expand( # {"query" => "an example search query"}, # ExampleProcessor # ).to_str # #=> "http://example.com/search/an+example+search+query/" # # Addressable::Template.new( # "http://example.com/search/{query}/" # ).expand( # {"query" => "an example search query"} # ).to_str # #=> "http://example.com/search/an%20example%20search%20query/" # # Addressable::Template.new( # "http://example.com/search/{query}/" # ).expand( # {"query" => "bogus!"}, # ExampleProcessor # ).to_str # #=> Addressable::Template::InvalidTemplateValueError # @param mapping [Hash] The mapping that corresponds to the pattern. # @param processor [#validate, #transform] An optional processor object may be supplied. # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true # @return [Addressable::URI] The expanded URI template. # # source://addressable//lib/addressable/template.rb#591 def expand(mapping, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end # Extracts a mapping from the URI using a URI Template pattern. # # @example # class ExampleProcessor # def self.restore(name, value) # return value.gsub(/\+/, " ") if name == "query" # return value # end # # def self.match(name) # return ".*?" if name == "first" # return ".*" # end # end # # uri = Addressable::URI.parse( # "http://example.com/search/an+example+search+query/" # ) # Addressable::Template.new( # "http://example.com/search/{query}/" # ).extract(uri, ExampleProcessor) # #=> {"query" => "an example search query"} # # uri = Addressable::URI.parse("http://example.com/a/b/c/") # Addressable::Template.new( # "http://example.com/{first}/{second}/" # ).extract(uri, ExampleProcessor) # #=> {"first" => "a", "second" => "b/c"} # # uri = Addressable::URI.parse("http://example.com/a/b/c/") # Addressable::Template.new( # "http://example.com/{first}/{-list|/|second}/" # ).extract(uri) # #=> {"first" => "a", "second" => ["b", "c"]} # @param uri [Addressable::URI, #to_str] The URI to extract from. # @param processor [#restore, #match] A template processor object may optionally be supplied. # # The object should respond to either the restore or # match messages or both. The restore method should # take two parameters: `[String] name` and `[String] value`. # The restore method should reverse any transformations that # have been performed on the value to ensure a valid URI. # The match method should take a single # parameter: `[String] name`. The match method should return # a String containing a regular expression capture group for # matching on that particular variable. The default value is `".*?"`. # The match method has no effect on multivariate operator # expansions. # @return [Hash, NilClass] The Hash mapping that was extracted from the URI, or # nil if the URI didn't match the template. # # source://addressable//lib/addressable/template.rb#342 def extract(uri, processor = T.unsafe(nil)); end # Freeze URI, initializing instance variables. # # @return [Addressable::URI] The frozen URI object. # # source://addressable//lib/addressable/template.rb#245 def freeze; end # Returns a String representation of the Template object's state. # # @return [String] The Template object's state, as a String. # # source://addressable//lib/addressable/template.rb#260 def inspect; end # Returns an Array of variables used within the template pattern. # The variables are listed in the Array in the order they appear within # the pattern. Multiple occurrences of a variable within a pattern are # not represented in this Array. # # @return [Array] The variables present in the template's pattern. # # source://addressable//lib/addressable/template.rb#607 def keys; end # Extracts match data from the URI using a URI Template pattern. # # @example # class ExampleProcessor # def self.restore(name, value) # return value.gsub(/\+/, " ") if name == "query" # return value # end # # def self.match(name) # return ".*?" if name == "first" # return ".*" # end # end # # uri = Addressable::URI.parse( # "http://example.com/search/an+example+search+query/" # ) # match = Addressable::Template.new( # "http://example.com/search/{query}/" # ).match(uri, ExampleProcessor) # match.variables # #=> ["query"] # match.captures # #=> ["an example search query"] # # uri = Addressable::URI.parse("http://example.com/a/b/c/") # match = Addressable::Template.new( # "http://example.com/{first}/{+second}/" # ).match(uri, ExampleProcessor) # match.variables # #=> ["first", "second"] # match.captures # #=> ["a", "b/c"] # # uri = Addressable::URI.parse("http://example.com/a/b/c/") # match = Addressable::Template.new( # "http://example.com/{first}{/second*}/" # ).match(uri) # match.variables # #=> ["first", "second"] # match.captures # #=> ["a", ["b", "c"]] # @param uri [Addressable::URI, #to_str] The URI to extract from. # @param processor [#restore, #match] A template processor object may optionally be supplied. # # The object should respond to either the restore or # match messages or both. The restore method should # take two parameters: `[String] name` and `[String] value`. # The restore method should reverse any transformations that # have been performed on the value to ensure a valid URI. # The match method should take a single # parameter: `[String] name`. The match method should return # a String containing a regular expression capture group for # matching on that particular variable. The default value is `".*?"`. # The match method has no effect on multivariate operator # expansions. # @return [Hash, NilClass] The Hash mapping that was extracted from the URI, or # nil if the URI didn't match the template. # # source://addressable//lib/addressable/template.rb#413 def match(uri, processor = T.unsafe(nil)); end # Returns the named captures of the coerced `Regexp`. # # @api private # @return [Hash] The named captures of the `Regexp` given by {#to_regexp}. # # source://addressable//lib/addressable/template.rb#651 def named_captures; end # Returns an Array of variables used within the template pattern. # The variables are listed in the Array in the order they appear within # the pattern. Multiple occurrences of a variable within a pattern are # not represented in this Array. # # @return [Array] The variables present in the template's pattern. # # source://addressable//lib/addressable/template.rb#607 def names; end # Expands a URI template into another URI template. # # The object should respond to either the validate or # transform messages or both. Both the validate and # transform methods should take two parameters: name and # value. The validate method should return true # or false; true if the value of the variable is valid, # false otherwise. An InvalidTemplateValueError # exception will be raised if the value is invalid. The transform # method should return the transformed variable value as a String. # If a transform method is used, the value will not be percent # encoded automatically. Unicode normalization will be performed both # before and after sending the value to the transform method. # # @example # Addressable::Template.new( # "http://example.com/{one}/{two}/" # ).partial_expand({"one" => "1"}).pattern # #=> "http://example.com/1/{two}/" # # Addressable::Template.new( # "http://example.com/{?one,two}/" # ).partial_expand({"one" => "1"}).pattern # #=> "http://example.com/?one=1{&two}/" # # Addressable::Template.new( # "http://example.com/{?one,two,three}/" # ).partial_expand({"one" => "1", "three" => 3}).pattern # #=> "http://example.com/?one=1{&two}&three=3" # @param mapping [Hash] The mapping that corresponds to the pattern. # @param processor [#validate, #transform] An optional processor object may be supplied. # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true # @return [Addressable::Template] The partially expanded URI template. # # source://addressable//lib/addressable/template.rb#524 def partial_expand(mapping, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end # @return [String] The Template object's pattern. # # source://addressable//lib/addressable/template.rb#254 def pattern; end # Returns the source of the coerced `Regexp`. # # @api private # @return [String] The source of the `Regexp` given by {#to_regexp}. # # source://addressable//lib/addressable/template.rb#641 def source; end # Coerces a template into a `Regexp` object. This regular expression will # behave very similarly to the actual template, and should match the same # URI values, but it cannot fully handle, for example, values that would # extract to an `Array`. # # @return [Regexp] A regular expression which should match the template. # # source://addressable//lib/addressable/template.rb#630 def to_regexp; end # Returns a mapping of variables to their default values specified # in the template. Variables without defaults are not returned. # # @return [Hash] Mapping of template variables to their defaults # # source://addressable//lib/addressable/template.rb#618 def variable_defaults; end # Returns an Array of variables used within the template pattern. # The variables are listed in the Array in the order they appear within # the pattern. Multiple occurrences of a variable within a pattern are # not represented in this Array. # # @return [Array] The variables present in the template's pattern. # # source://addressable//lib/addressable/template.rb#607 def variables; end private # Takes a set of values, and joins them together based on the # operator. # # @param operator [String, Nil] One of the operators from the set # (?,&,+,#,;,/,.), or nil if there wasn't one. # @param return_value [Array] The set of return values (as [variable_name, value] tuples) that will # be joined together. # @return [String] The transformed mapped value # # source://addressable//lib/addressable/template.rb#861 def join_values(operator, return_value); end # Generates a hash with string keys # # @param mapping [Hash] A mapping hash to normalize # @return [Hash] A hash with stringified keys # # source://addressable//lib/addressable/template.rb#924 def normalize_keys(mapping); end # Takes a set of values, and joins them together based on the # operator. # # @param value [Hash, Array, String] Normalizes unicode keys and values with String#unicode_normalize (NFC) # @return [Hash, Array, String] The normalized values # # source://addressable//lib/addressable/template.rb#898 def normalize_value(value); end # source://addressable//lib/addressable/template.rb#656 def ordered_variable_defaults; end # Generates the Regexp that parses a template pattern. # # @param pattern [String] The URI template pattern. # @param processor [#match] The template processor to use. # @return [Array, Regexp] An array of expansion variables nad a regular expression which may be # used to parse a template pattern # # source://addressable//lib/addressable/template.rb#968 def parse_new_template_pattern(pattern, processor = T.unsafe(nil)); end # Generates the Regexp that parses a template pattern. Memoizes the # value if template processor not set (processors may not be deterministic) # # @param pattern [String] The URI template pattern. # @param processor [#match] The template processor to use. # @return [Array, Regexp] An array of expansion variables nad a regular expression which may be # used to parse a template pattern # # source://addressable//lib/addressable/template.rb#950 def parse_template_pattern(pattern, processor = T.unsafe(nil)); end # Transforms a mapped value so that values can be substituted into the # template. # # The object should respond to either the validate or # transform messages or both. Both the validate and # transform methods should take two parameters: name and # value. The validate method should return true # or false; true if the value of the variable is valid, # false otherwise. An InvalidTemplateValueError exception # will be raised if the value is invalid. The transform method # should return the transformed variable value as a String. If a # transform method is used, the value will not be percent encoded # automatically. Unicode normalization will be performed both before and # after sending the value to the transform method. # # @param mapping [Hash] The mapping to replace captures # @param capture [String] The expression to replace # @param processor [#validate, #transform] An optional processor object may be supplied. # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true # @return [String] The expanded expression # # source://addressable//lib/addressable/template.rb#753 def transform_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end # Loops through each capture and expands any values available in mapping # # The object should respond to either the validate or # transform messages or both. Both the validate and # transform methods should take two parameters: name and # value. The validate method should return true # or false; true if the value of the variable is valid, # false otherwise. An InvalidTemplateValueError exception # will be raised if the value is invalid. The transform method # should return the transformed variable value as a String. If a # transform method is used, the value will not be percent encoded # automatically. Unicode normalization will be performed both before and # after sending the value to the transform method. # # @param mapping [Hash] Set of keys to expand # @param capture [String] The expression to expand # @param processor [#validate, #transform] An optional processor object may be supplied. # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true # @return [String] The expanded expression # # source://addressable//lib/addressable/template.rb#694 def transform_partial_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end end # source://addressable//lib/addressable/template.rb#58 Addressable::Template::EXPRESSION = T.let(T.unsafe(nil), Regexp) # Raised if an invalid template operator is used in a pattern. # # source://addressable//lib/addressable/template.rb#85 class Addressable::Template::InvalidTemplateOperatorError < ::StandardError; end # Raised if an invalid template value is supplied. # # source://addressable//lib/addressable/template.rb#80 class Addressable::Template::InvalidTemplateValueError < ::StandardError; end # source://addressable//lib/addressable/template.rb#70 Addressable::Template::JOINERS = T.let(T.unsafe(nil), Hash) # source://addressable//lib/addressable/template.rb#62 Addressable::Template::LEADERS = T.let(T.unsafe(nil), Hash) # This class represents the data that is extracted when a Template # is matched against a URI. # # source://addressable//lib/addressable/template.rb#96 class Addressable::Template::MatchData # Creates a new MatchData object. # MatchData objects should never be instantiated directly. # # @param uri [Addressable::URI] The URI that the template was matched against. # @return [MatchData] a new instance of MatchData # # source://addressable//lib/addressable/template.rb#103 def initialize(uri, template, mapping); end # Accesses captured values by name or by index. # # @param key [String, Symbol, Fixnum] Capture index or name. Note that when accessing by with index # of 0, the full URI will be returned. The intention is to mimic # the ::MatchData#[] behavior. # @param len [#to_int, nil] If provided, an array of values will be returend with the given # parameter used as length. # @return [Array, String, nil] The captured value corresponding to the index or name. If the # value was not provided or the key is unknown, nil will be # returned. # # If the second parameter is provided, an array of that length will # be returned instead. # # source://addressable//lib/addressable/template.rb#170 def [](key, len = T.unsafe(nil)); end # @return [Array] The list of values that were captured by the Template. # Note that this list will include nils for any variables which # were in the Template, but did not appear in the URI. # # source://addressable//lib/addressable/template.rb#143 def captures; end # Returns a String representation of the MatchData's state. # # @return [String] The MatchData's state, as a String. # # source://addressable//lib/addressable/template.rb#213 def inspect; end # @return [Array] The list of variables that were present in the Template. # Note that this list will include variables which do not appear # in the mapping because they were not present in URI. # # source://addressable//lib/addressable/template.rb#132 def keys; end # @return [Hash] The mapping that resulted from the match. # Note that this mapping does not include keys or values for # variables that appear in the Template, but are not present # in the URI. # # source://addressable//lib/addressable/template.rb#125 def mapping; end # @return [Array] The list of variables that were present in the Template. # Note that this list will include variables which do not appear # in the mapping because they were not present in URI. # # source://addressable//lib/addressable/template.rb#132 def names; end # Dummy method for code expecting a ::MatchData instance # # @return [String] An empty string. # # source://addressable//lib/addressable/template.rb#222 def post_match; end # Dummy method for code expecting a ::MatchData instance # # @return [String] An empty string. # # source://addressable//lib/addressable/template.rb#222 def pre_match; end # @return [String] The matched URI as String. # # source://addressable//lib/addressable/template.rb#191 def string; end # @return [Addressable::Template] The Template used for the match. # # source://addressable//lib/addressable/template.rb#117 def template; end # @return [Array] Array with the matched URI as first element followed by the captured # values. # # source://addressable//lib/addressable/template.rb#184 def to_a; end # @return [String] The matched URI as String. # # source://addressable//lib/addressable/template.rb#191 def to_s; end # @return [Addressable::URI] The URI that the Template was matched against. # # source://addressable//lib/addressable/template.rb#112 def uri; end # @return [Array] The list of values that were captured by the Template. # Note that this list will include nils for any variables which # were in the Template, but did not appear in the URI. # # source://addressable//lib/addressable/template.rb#143 def values; end # Returns multiple captured values at once. # # @param *indexes [String, Symbol, Fixnum] Indices of the captures to be returned # @return [Array] Values corresponding to given indices. # @see Addressable::Template::MatchData#[] # # source://addressable//lib/addressable/template.rb#205 def values_at(*indexes); end # @return [Array] The list of variables that were present in the Template. # Note that this list will include variables which do not appear # in the mapping because they were not present in URI. # # source://addressable//lib/addressable/template.rb#132 def variables; end end # source://addressable//lib/addressable/template.rb#40 Addressable::Template::RESERVED = T.let(T.unsafe(nil), String) # Raised if an invalid template operator is used in a pattern. # # source://addressable//lib/addressable/template.rb#90 class Addressable::Template::TemplateOperatorAbortedError < ::StandardError; end # source://addressable//lib/addressable/template.rb#42 Addressable::Template::UNRESERVED = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/template.rb#54 Addressable::Template::VARIABLE_LIST = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/template.rb#50 Addressable::Template::VARNAME = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/template.rb#52 Addressable::Template::VARSPEC = T.let(T.unsafe(nil), Regexp) # This is an implementation of a URI parser based on # RFC 3986, # RFC 3987. # # source://addressable//lib/addressable/uri.rb#31 class Addressable::URI # Creates a new uri object from component parts. # # @option [String, # @option [String, # @option [String, # @option [String, # @option [String, # @option [String, # @option [String, # @option [String, # @option [String, # @option [String, # @param [String, [Hash] a customizable set of options # @return [Addressable::URI] The constructed URI object. # # source://addressable//lib/addressable/uri.rb#823 def initialize(options = T.unsafe(nil)); end # Joins two URIs together. # # @param The [String, Addressable::URI, #to_str] URI to join with. # @return [Addressable::URI] The joined URI. # # source://addressable//lib/addressable/uri.rb#1882 def +(uri); end # Returns true if the URI objects are equal. This method # normalizes both URIs before doing the comparison. # # @param uri [Object] The URI to compare. # @return [TrueClass, FalseClass] true if the URIs are equivalent, false # otherwise. # # source://addressable//lib/addressable/uri.rb#2232 def ==(uri); end # Returns true if the URI objects are equal. This method # normalizes both URIs before doing the comparison, and allows comparison # against Strings. # # @param uri [Object] The URI to compare. # @return [TrueClass, FalseClass] true if the URIs are equivalent, false # otherwise. # # source://addressable//lib/addressable/uri.rb#2210 def ===(uri); end # Determines if the URI is absolute. # # @return [TrueClass, FalseClass] true if the URI is absolute. false # otherwise. # # source://addressable//lib/addressable/uri.rb#1872 def absolute?; end # The authority component for this URI. # Combines the user, password, host, and port components. # # @return [String] The authority component. # # source://addressable//lib/addressable/uri.rb#1227 def authority; end # Sets the authority component for this URI. # # @param new_authority [String, #to_str] The new authority component. # # source://addressable//lib/addressable/uri.rb#1267 def authority=(new_authority); end # The basename, if any, of the file in the path component. # # @return [String] The path's basename. # # source://addressable//lib/addressable/uri.rb#1581 def basename; end # The default port for this URI's scheme. # This method will always returns the default port for the URI's scheme # regardless of the presence of an explicit port in the URI. # # @return [Integer] The default port. # # source://addressable//lib/addressable/uri.rb#1447 def default_port; end # This method allows you to make several changes to a URI simultaneously, # which separately would cause validation errors, but in conjunction, # are valid. The URI will be revalidated as soon as the entire block has # been executed. # # @param block [Proc] A set of operations to perform on a given URI. # # source://addressable//lib/addressable/uri.rb#2389 def defer_validation; end # Creates a URI suitable for display to users. If semantic attacks are # likely, the application should try to detect these and warn the user. # See RFC 3986, # section 7.6 for more information. # # @return [Addressable::URI] A URI suitable for display purposes. # # source://addressable//lib/addressable/uri.rb#2194 def display_uri; end # Returns the public suffix domain for this host. # # @example # Addressable::URI.parse("http://www.example.co.uk").domain # => "example.co.uk" # # source://addressable//lib/addressable/uri.rb#1218 def domain; end # Clones the URI object. # # @return [Addressable::URI] The cloned URI. # # source://addressable//lib/addressable/uri.rb#2264 def dup; end # Determines if the URI is an empty string. # # @return [TrueClass, FalseClass] Returns true if empty, false otherwise. # # source://addressable//lib/addressable/uri.rb#2326 def empty?; end # Returns true if the URI objects are equal. This method # does NOT normalize either URI before doing the comparison. # # @param uri [Object] The URI to compare. # @return [TrueClass, FalseClass] true if the URIs are equivalent, false # otherwise. # # source://addressable//lib/addressable/uri.rb#2246 def eql?(uri); end # The extname, if any, of the file in the path component. # Empty string if there is no extension. # # @return [String] The path's extname. # # source://addressable//lib/addressable/uri.rb#1591 def extname; end # The fragment component for this URI. # # @return [String] The fragment component. # # source://addressable//lib/addressable/uri.rb#1803 def fragment; end # Sets the fragment component for this URI. # # @param new_fragment [String, #to_str] The new fragment component. # # source://addressable//lib/addressable/uri.rb#1828 def fragment=(new_fragment); end # Freeze URI, initializing instance variables. # # @return [Addressable::URI] The frozen URI object. # # source://addressable//lib/addressable/uri.rb#863 def freeze; end # A hash value that will make a URI equivalent to its normalized # form. # # @return [Integer] A hash of the URI. # # source://addressable//lib/addressable/uri.rb#2256 def hash; end # The host component for this URI. # # @return [String] The host component. # # source://addressable//lib/addressable/uri.rb#1113 def host; end # Sets the host component for this URI. # # @param new_host [String, #to_str] The new host component. # # source://addressable//lib/addressable/uri.rb#1149 def host=(new_host); end # This method is same as URI::Generic#host except # brackets for IPv6 (and 'IPvFuture') addresses are removed. # # @return [String] The hostname for this URI. # @see Addressable::URI#host # # source://addressable//lib/addressable/uri.rb#1171 def hostname; end # This method is same as URI::Generic#host= except # the argument can be a bare IPv6 address (or 'IPvFuture'). # # @param new_hostname [String, #to_str] The new hostname for this URI. # @see Addressable::URI#host= # # source://addressable//lib/addressable/uri.rb#1183 def hostname=(new_hostname); end # The inferred port component for this URI. # This method will normalize to the default port for the URI's scheme if # the port isn't explicitly specified in the URI. # # @return [Integer] The inferred port component. # # source://addressable//lib/addressable/uri.rb#1433 def inferred_port; end # Returns a String representation of the URI object's state. # # @return [String] The URI object's state, as a String. # # source://addressable//lib/addressable/uri.rb#2377 def inspect; end # Determines if the scheme indicates an IP-based protocol. # # @return [TrueClass, FalseClass] true if the scheme indicates an IP-based protocol. # false otherwise. # # source://addressable//lib/addressable/uri.rb#1848 def ip_based?; end # Joins two URIs together. # # @param The [String, Addressable::URI, #to_str] URI to join with. # @return [Addressable::URI] The joined URI. # # source://addressable//lib/addressable/uri.rb#1882 def join(uri); end # Destructive form of join. # # @param The [String, Addressable::URI, #to_str] URI to join with. # @return [Addressable::URI] The joined URI. # @see Addressable::URI#join # # source://addressable//lib/addressable/uri.rb#1985 def join!(uri); end # Merges a URI with a Hash of components. # This method has different behavior from join. Any # components present in the hash parameter will override the # original components. The path component is not treated specially. # # @param The [Hash, Addressable::URI, #to_hash] components to merge with. # @return [Addressable::URI] The merged URI. # @see Hash#merge # # source://addressable//lib/addressable/uri.rb#2000 def merge(hash); end # Destructive form of merge. # # @param The [Hash, Addressable::URI, #to_hash] components to merge with. # @return [Addressable::URI] The merged URI. # @see Addressable::URI#merge # # source://addressable//lib/addressable/uri.rb#2065 def merge!(uri); end # Returns a normalized URI object. # # NOTE: This method does not attempt to fully conform to specifications. # It exists largely to correct other people's failures to read the # specifications, and also to deal with caching issues since several # different URIs may represent the same resource and should not be # cached multiple times. # # @return [Addressable::URI] The normalized URI. # # source://addressable//lib/addressable/uri.rb#2157 def normalize; end # Destructively normalizes this URI object. # # @return [Addressable::URI] The normalized URI. # @see Addressable::URI#normalize # # source://addressable//lib/addressable/uri.rb#2183 def normalize!; end # The authority component for this URI, normalized. # # @return [String] The authority component, normalized. # # source://addressable//lib/addressable/uri.rb#1245 def normalized_authority; end # The fragment component for this URI, normalized. # # @return [String] The fragment component, normalized. # # source://addressable//lib/addressable/uri.rb#1809 def normalized_fragment; end # The host component for this URI, normalized. # # @return [String] The host component, normalized. # # source://addressable//lib/addressable/uri.rb#1119 def normalized_host; end # The password component for this URI, normalized. # # @return [String] The password component, normalized. # # source://addressable//lib/addressable/uri.rb#995 def normalized_password; end # The path component for this URI, normalized. # # @return [String] The path component, normalized. # # source://addressable//lib/addressable/uri.rb#1528 def normalized_path; end # The port component for this URI, normalized. # # @return [Integer] The port component, normalized. # # source://addressable//lib/addressable/uri.rb#1385 def normalized_port; end # The query component for this URI, normalized. # # @return [String] The query component, normalized. # # source://addressable//lib/addressable/uri.rb#1606 def normalized_query(*flags); end # The scheme component for this URI, normalized. # # @return [String] The scheme component, normalized. # # source://addressable//lib/addressable/uri.rb#889 def normalized_scheme; end # The normalized combination of components that represent a site. # Combines the scheme, user, password, host, and port components. # Primarily useful for HTTP and HTTPS. # # For example, "http://example.com/path?query" would have a # site value of "http://example.com". # # @return [String] The normalized components that identify a site. # # source://addressable//lib/addressable/uri.rb#1478 def normalized_site; end # The user component for this URI, normalized. # # @return [String] The user component, normalized. # # source://addressable//lib/addressable/uri.rb#940 def normalized_user; end # The userinfo component for this URI, normalized. # # @return [String] The userinfo component, normalized. # # source://addressable//lib/addressable/uri.rb#1061 def normalized_userinfo; end # Omits components from a URI. # # @example # uri = Addressable::URI.parse("http://example.com/path?query") # #=> # # uri.omit(:scheme, :authority) # #=> # # @param *components [Symbol] The components to be omitted. # @return [Addressable::URI] The URI with components omitted. # # source://addressable//lib/addressable/uri.rb#2290 def omit(*components); end # Destructive form of omit. # # @param *components [Symbol] The components to be omitted. # @return [Addressable::URI] The URI with components omitted. # @see Addressable::URI#omit # # source://addressable//lib/addressable/uri.rb#2317 def omit!(*components); end # The origin for this URI, serialized to ASCII, as per # RFC 6454, section 6.2. # # @return [String] The serialized origin. # # source://addressable//lib/addressable/uri.rb#1307 def origin; end # Sets the origin for this URI, serialized to ASCII, as per # RFC 6454, section 6.2. This assignment will reset the `userinfo` # component. # # @param new_origin [String, #to_str] The new origin component. # # source://addressable//lib/addressable/uri.rb#1326 def origin=(new_origin); end # The password component for this URI. # # @return [String] The password component. # # source://addressable//lib/addressable/uri.rb#989 def password; end # Sets the password component for this URI. # # @param new_password [String, #to_str] The new password component. # # source://addressable//lib/addressable/uri.rb#1018 def password=(new_password); end # The path component for this URI. # # @return [String] The path component. # # source://addressable//lib/addressable/uri.rb#1521 def path; end # Sets the path component for this URI. # # @param new_path [String, #to_str] The new path component. # # source://addressable//lib/addressable/uri.rb#1560 def path=(new_path); end # The port component for this URI. # This is the port number actually given in the URI. This does not # infer port numbers from default values. # # @return [Integer] The port component. # # source://addressable//lib/addressable/uri.rb#1379 def port; end # Sets the port component for this URI. # # @param new_port [String, Integer, #to_s] The new port component. # # source://addressable//lib/addressable/uri.rb#1401 def port=(new_port); end # The query component for this URI. # # @return [String] The query component. # # source://addressable//lib/addressable/uri.rb#1600 def query; end # Sets the query component for this URI. # # @param new_query [String, #to_str] The new query component. # # source://addressable//lib/addressable/uri.rb#1634 def query=(new_query); end # Converts the query component to a Hash value. # # @example # Addressable::URI.parse("?one=1&two=2&three=3").query_values # #=> {"one" => "1", "two" => "2", "three" => "3"} # Addressable::URI.parse("?one=two&one=three").query_values(Array) # #=> [["one", "two"], ["one", "three"]] # Addressable::URI.parse("?one=two&one=three").query_values(Hash) # #=> {"one" => "three"} # Addressable::URI.parse("?").query_values # #=> {} # Addressable::URI.parse("").query_values # #=> nil # @param return_type [Class] The return type desired. Value must be either # `Hash` or `Array`. # @return [Hash, Array, nil] The query string parsed as a Hash or Array # or nil if the query string is blank. # # source://addressable//lib/addressable/uri.rb#1665 def query_values(return_type = T.unsafe(nil)); end # Sets the query component for this URI from a Hash object. # An empty Hash or Array will result in an empty query string. # # @example # uri.query_values = {:a => "a", :b => ["c", "d", "e"]} # uri.query # # => "a=a&b=c&b=d&b=e" # uri.query_values = [['a', 'a'], ['b', 'c'], ['b', 'd'], ['b', 'e']] # uri.query # # => "a=a&b=c&b=d&b=e" # uri.query_values = [['a', 'a'], ['b', ['c', 'd', 'e']]] # uri.query # # => "a=a&b=c&b=d&b=e" # uri.query_values = [['flag'], ['key', 'value']] # uri.query # # => "flag&key=value" # @param new_query_values [Hash, #to_hash, Array] The new query values. # # source://addressable//lib/addressable/uri.rb#1716 def query_values=(new_query_values); end # Determines if the URI is relative. # # @return [TrueClass, FalseClass] true if the URI is relative. false # otherwise. # # source://addressable//lib/addressable/uri.rb#1862 def relative?; end # The HTTP request URI for this URI. This is the path and the # query string. # # @return [String] The request URI required for an HTTP request. # # source://addressable//lib/addressable/uri.rb#1767 def request_uri; end # Sets the HTTP request URI for this URI. # # @param new_request_uri [String, #to_str] The new HTTP request URI. # # source://addressable//lib/addressable/uri.rb#1779 def request_uri=(new_request_uri); end # Returns the shortest normalized relative form of this URI that uses the # supplied URI as a base for resolution. Returns an absolute URI if # necessary. This is effectively the opposite of route_to. # # @param uri [String, Addressable::URI, #to_str] The URI to route from. # @return [Addressable::URI] The normalized relative URI that is equivalent to the original URI. # # source://addressable//lib/addressable/uri.rb#2078 def route_from(uri); end # Returns the shortest normalized relative form of the supplied URI that # uses this URI as a base for resolution. Returns an absolute URI if # necessary. This is effectively the opposite of route_from. # # @param uri [String, Addressable::URI, #to_str] The URI to route to. # @return [Addressable::URI] The normalized relative URI that is equivalent to the supplied URI. # # source://addressable//lib/addressable/uri.rb#2143 def route_to(uri); end # The scheme component for this URI. # # @return [String] The scheme component. # # source://addressable//lib/addressable/uri.rb#883 def scheme; end # Sets the scheme component for this URI. # # @param new_scheme [String, #to_str] The new scheme component. # # source://addressable//lib/addressable/uri.rb#910 def scheme=(new_scheme); end # The combination of components that represent a site. # Combines the scheme, user, password, host, and port components. # Primarily useful for HTTP and HTTPS. # # For example, "http://example.com/path?query" would have a # site value of "http://example.com". # # @return [String] The components that identify a site. # # source://addressable//lib/addressable/uri.rb#1460 def site; end # Sets the site value for this URI. # # @param new_site [String, #to_str] The new site value. # # source://addressable//lib/addressable/uri.rb#1499 def site=(new_site); end # Returns the top-level domain for this host. # # @example # Addressable::URI.parse("http://www.example.co.uk").tld # => "co.uk" # # source://addressable//lib/addressable/uri.rb#1200 def tld; end # Sets the top-level domain for this URI. # # @param new_tld [String, #to_str] The new top-level domain. # # source://addressable//lib/addressable/uri.rb#1208 def tld=(new_tld); end # Returns a Hash of the URI components. # # @return [Hash] The URI as a Hash of components. # # source://addressable//lib/addressable/uri.rb#2360 def to_hash; end # Converts the URI to a String. # # @return [String] The URI's String representation. # # source://addressable//lib/addressable/uri.rb#2334 def to_s; end # Converts the URI to a String. # URI's are glorified Strings. Allow implicit conversion. # # @return [String] The URI's String representation. # # source://addressable//lib/addressable/uri.rb#2334 def to_str; end # The user component for this URI. # # @return [String] The user component. # # source://addressable//lib/addressable/uri.rb#934 def user; end # Sets the user component for this URI. # # @param new_user [String, #to_str] The new user component. # # source://addressable//lib/addressable/uri.rb#963 def user=(new_user); end # The userinfo component for this URI. # Combines the user and password components. # # @return [String] The userinfo component. # # source://addressable//lib/addressable/uri.rb#1045 def userinfo; end # Sets the userinfo component for this URI. # # @param new_userinfo [String, #to_str] The new userinfo component. # # source://addressable//lib/addressable/uri.rb#1084 def userinfo=(new_userinfo); end protected # Converts the string to be UTF-8 if it is not already UTF-8 # # @api private # # source://addressable//lib/addressable/uri.rb#2535 def force_utf8_encoding_if_needed(str); end # Resets composite values for the entire URI # # @api private # # source://addressable//lib/addressable/uri.rb#2526 def remove_composite_values; end # Replaces the internal state of self with the specified URI's state. # Used in destructive operations to avoid massive code repetition. # # @param uri [Addressable::URI] The URI to replace self with. # @return [Addressable::URI] self. # # source://addressable//lib/addressable/uri.rb#2493 def replace_self(uri); end # Splits path string with "/" (slash). # It is considered that there is empty string after last slash when # path ends with slash. # # @param path [String] The path to split. # @return [Array] An array of parts of path. # # source://addressable//lib/addressable/uri.rb#2516 def split_path(path); end # Ensures that the URI is valid. # # source://addressable//lib/addressable/uri.rb#2450 def validate; end private # Resets instance variables # # @api private # # source://addressable//lib/addressable/uri.rb#2547 def reset_ivs; end class << self # Converts a path to a file scheme URI. If the path supplied is # relative, it will be returned as a relative URI. If the path supplied # is actually a non-file URI, it will parse the URI as if it had been # parsed with Addressable::URI.parse. Handles all of the # various Microsoft-specific formats for specifying paths. # # @example # base = Addressable::URI.convert_path("/absolute/path/") # uri = Addressable::URI.convert_path("relative/path") # (base + uri).to_s # #=> "file:///absolute/path/relative/path" # # Addressable::URI.convert_path( # "c:\\windows\\My Documents 100%20\\foo.txt" # ).to_s # #=> "file:///c:/windows/My%20Documents%20100%20/foo.txt" # # Addressable::URI.convert_path("http://example.com/").to_s # #=> "http://example.com/" # @param path [String, Addressable::URI, #to_str] Typically a String path to a file or directory, but # will return a sensible return value if an absolute URI is supplied # instead. # @return [Addressable::URI] The parsed file scheme URI or the original URI if some other URI # scheme was provided. # # source://addressable//lib/addressable/uri.rb#279 def convert_path(path); end # Percent encodes any special characters in the URI. # # @param uri [String, Addressable::URI, #to_str] The URI to encode. # @param return_type [Class] The type of object to return. # This value may only be set to String or # Addressable::URI. All other values are invalid. Defaults # to String. # @return [String, Addressable::URI] The encoded URI. # The return type is determined by the return_type # parameter. # # source://addressable//lib/addressable/uri.rb#609 def encode(uri, return_type = T.unsafe(nil)); end # Percent encodes a URI component. # # '9' to be percent encoded. If a Regexp is passed, the # value /[^b-zB-Z0-9]/ would have the same effect. A set of # useful String values may be found in the # Addressable::URI::CharacterClasses module. The default # value is the reserved plus unreserved character classes specified in # RFC 3986. # # @example # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9") # => "simple%2Fex%61mple" # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/) # => "simple%2Fex%61mple" # Addressable::URI.encode_component( # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED # ) # => "simple%2Fexample" # @param component [String, #to_str] The URI component to encode. # @param character_class [String, Regexp] The characters which are not percent encoded. If a String # is passed, the String must be formatted as a regular # expression character class. (Do not include the surrounding square # brackets.) For example, "b-zB-Z0-9" would cause # everything but the letters 'b' through 'z' and the numbers '0' through # @param upcase_encoded [Regexp] A string of characters that may already be percent encoded, and whose # encodings should be upcased. This allows normalization of percent # encodings for characters not included in the # character_class. # @return [String] The encoded component. # # source://addressable//lib/addressable/uri.rb#394 def encode_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end # Percent encodes any special characters in the URI. # # @param uri [String, Addressable::URI, #to_str] The URI to encode. # @param return_type [Class] The type of object to return. # This value may only be set to String or # Addressable::URI. All other values are invalid. Defaults # to String. # @return [String, Addressable::URI] The encoded URI. # The return type is determined by the return_type # parameter. # # source://addressable//lib/addressable/uri.rb#609 def escape(uri, return_type = T.unsafe(nil)); end # Percent encodes a URI component. # # '9' to be percent encoded. If a Regexp is passed, the # value /[^b-zB-Z0-9]/ would have the same effect. A set of # useful String values may be found in the # Addressable::URI::CharacterClasses module. The default # value is the reserved plus unreserved character classes specified in # RFC 3986. # # @example # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9") # => "simple%2Fex%61mple" # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/) # => "simple%2Fex%61mple" # Addressable::URI.encode_component( # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED # ) # => "simple%2Fexample" # @param component [String, #to_str] The URI component to encode. # @param character_class [String, Regexp] The characters which are not percent encoded. If a String # is passed, the String must be formatted as a regular # expression character class. (Do not include the surrounding square # brackets.) For example, "b-zB-Z0-9" would cause # everything but the letters 'b' through 'z' and the numbers '0' through # @param upcase_encoded [Regexp] A string of characters that may already be percent encoded, and whose # encodings should be upcased. This allows normalization of percent # encodings for characters not included in the # character_class. # @return [String] The encoded component. # # source://addressable//lib/addressable/uri.rb#394 def escape_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end # Encodes a set of key/value pairs according to the rules for the # application/x-www-form-urlencoded MIME type. # # @param form_values [#to_hash, #to_ary] The form values to encode. # @param sort [TrueClass, FalseClass] Sort the key/value pairs prior to encoding. # Defaults to false. # @return [String] The encoded value. # # source://addressable//lib/addressable/uri.rb#733 def form_encode(form_values, sort = T.unsafe(nil)); end # Decodes a String according to the rules for the # application/x-www-form-urlencoded MIME type. # # @param encoded_value [String, #to_str] The form values to decode. # @return [Array] The decoded values. # This is not a Hash because of the possibility for # duplicate keys. # # source://addressable//lib/addressable/uri.rb#786 def form_unencode(encoded_value); end # Converts an input to a URI. The input does not have to be a valid # URI — the method will use heuristics to guess what URI was intended. # This is not standards-compliant, merely user-friendly. # # @param uri [String, Addressable::URI, #to_str] The URI string to parse. # No parsing is performed if the object is already an # Addressable::URI. # @param hints [Hash] A Hash of hints to the heuristic parser. # Defaults to {:scheme => "http"}. # @return [Addressable::URI] The parsed URI. # # source://addressable//lib/addressable/uri.rb#178 def heuristic_parse(uri, hints = T.unsafe(nil)); end # Returns an array of known ip-based schemes. These schemes typically # use a similar URI form: # //:@:/ # # source://addressable//lib/addressable/uri.rb#1362 def ip_based_schemes; end # Joins several URIs together. # # @example # base = "http://example.com/" # uri = Addressable::URI.parse("relative/path") # Addressable::URI.join(base, uri) # #=> # # @param *uris [String, Addressable::URI, #to_str] The URIs to join. # @return [Addressable::URI] The joined URI. # # source://addressable//lib/addressable/uri.rb#330 def join(*uris); end # Normalizes the encoding of a URI component. # # @example # Addressable::URI.normalize_component("simpl%65/%65xampl%65", "b-zB-Z") # => "simple%2Fex%61mple" # Addressable::URI.normalize_component( # "simpl%65/%65xampl%65", /[^b-zB-Z]/ # ) # => "simple%2Fex%61mple" # Addressable::URI.normalize_component( # "simpl%65/%65xampl%65", # Addressable::URI::CharacterClasses::UNRESERVED # ) # => "simple%2Fexample" # Addressable::URI.normalize_component( # "one%20two%2fthree%26four", # "0-9a-zA-Z &/", # "/" # ) # => "one two%2Fthree&four" # @param component [String, #to_str] The URI component to encode. # @param character_class [String, Regexp] The characters which are not percent encoded. If a String # is passed, the String must be formatted as a regular # expression character class. (Do not include the surrounding square # brackets.) For example, "b-zB-Z0-9" would cause # everything but the letters 'b' through 'z' and the numbers '0' # through '9' to be percent encoded. If a Regexp is passed, # the value /[^b-zB-Z0-9]/ would have the same effect. A # set of useful String values may be found in the # Addressable::URI::CharacterClasses module. The default # value is the reserved plus unreserved character classes specified in # RFC 3986. # @param leave_encoded [String] When character_class is a String then # leave_encoded is a string of characters that should remain # percent encoded while normalizing the component; if they appear percent # encoded in the original component, then they will be upcased ("%2f" # normalized to "%2F") but otherwise left alone. # @return [String] The normalized component. # # source://addressable//lib/addressable/uri.rb#544 def normalize_component(component, character_class = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end # Resolves paths to their simplest form. # # @param path [String] The path to normalize. # @return [String] The normalized path. # # source://addressable//lib/addressable/uri.rb#2414 def normalize_path(path); end # Normalizes the encoding of a URI. Characters within a hostname are # not percent encoded to allow for internationalized domain names. # # @param uri [String, Addressable::URI, #to_str] The URI to encode. # @param return_type [Class] The type of object to return. # This value may only be set to String or # Addressable::URI. All other values are invalid. Defaults # to String. # @return [String, Addressable::URI] The encoded URI. # The return type is determined by the return_type # parameter. # # source://addressable//lib/addressable/uri.rb#664 def normalized_encode(uri, return_type = T.unsafe(nil)); end # Returns a URI object based on the parsed string. # # @param uri [String, Addressable::URI, #to_str] The URI string to parse. # No parsing is performed if the object is already an # Addressable::URI. # @return [Addressable::URI] The parsed URI. # # source://addressable//lib/addressable/uri.rb#101 def parse(uri); end # Returns a hash of common IP-based schemes and their default port # numbers. Adding new schemes to this hash, as necessary, will allow # for better URI normalization. # # source://addressable//lib/addressable/uri.rb#1369 def port_mapping; end # Unencodes any percent encoded characters within a URI component. # This method may be used for unencoding either components or full URIs, # however, it is recommended to use the unencode_component # alias when unencoding components. # # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode. # @param return_type [Class] The type of object to return. # This value may only be set to String or # Addressable::URI. All other values are invalid. Defaults # to String. # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character # in this list is encountered then it will remain percent encoded. # @return [String, Addressable::URI] The unencoded component or URI. # The return type is determined by the return_type # parameter. # # source://addressable//lib/addressable/uri.rb#464 def unencode(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end # Unencodes any percent encoded characters within a URI component. # This method may be used for unencoding either components or full URIs, # however, it is recommended to use the unencode_component # alias when unencoding components. # # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode. # @param return_type [Class] The type of object to return. # This value may only be set to String or # Addressable::URI. All other values are invalid. Defaults # to String. # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character # in this list is encountered then it will remain percent encoded. # @return [String, Addressable::URI] The unencoded component or URI. # The return type is determined by the return_type # parameter. # # source://addressable//lib/addressable/uri.rb#464 def unencode_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end # Unencodes any percent encoded characters within a URI component. # This method may be used for unencoding either components or full URIs, # however, it is recommended to use the unencode_component # alias when unencoding components. # # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode. # @param return_type [Class] The type of object to return. # This value may only be set to String or # Addressable::URI. All other values are invalid. Defaults # to String. # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character # in this list is encountered then it will remain percent encoded. # @return [String, Addressable::URI] The unencoded component or URI. # The return type is determined by the return_type # parameter. # # source://addressable//lib/addressable/uri.rb#464 def unescape(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end # Unencodes any percent encoded characters within a URI component. # This method may be used for unencoding either components or full URIs, # however, it is recommended to use the unencode_component # alias when unencoding components. # # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode. # @param return_type [Class] The type of object to return. # This value may only be set to String or # Addressable::URI. All other values are invalid. Defaults # to String. # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character # in this list is encountered then it will remain percent encoded. # @return [String, Addressable::URI] The unencoded component or URI. # The return type is determined by the return_type # parameter. # # source://addressable//lib/addressable/uri.rb#464 def unescape_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end end end # Container for the character classes specified in # RFC 3986. # # Note: Concatenated and interpolated `String`s are not affected by the # `frozen_string_literal` directive and must be frozen explicitly. # # Interpolated `String`s *were* frozen this way before Ruby 3.0: # https://bugs.ruby-lang.org/issues/17104 # # source://addressable//lib/addressable/uri.rb#46 module Addressable::URI::CharacterClasses; end # source://addressable//lib/addressable/uri.rb#47 Addressable::URI::CharacterClasses::ALPHA = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#56 Addressable::URI::CharacterClasses::AUTHORITY = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#48 Addressable::URI::CharacterClasses::DIGIT = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#59 Addressable::URI::CharacterClasses::FRAGMENT = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#49 Addressable::URI::CharacterClasses::GEN_DELIMS = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#55 Addressable::URI::CharacterClasses::HOST = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#57 Addressable::URI::CharacterClasses::PATH = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#53 Addressable::URI::CharacterClasses::PCHAR = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#58 Addressable::URI::CharacterClasses::QUERY = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#51 Addressable::URI::CharacterClasses::RESERVED = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#54 Addressable::URI::CharacterClasses::SCHEME = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#50 Addressable::URI::CharacterClasses::SUB_DELIMS = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#52 Addressable::URI::CharacterClasses::UNRESERVED = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#72 Addressable::URI::EMPTY_STR = T.let(T.unsafe(nil), String) # Raised if something other than a uri is supplied. # # source://addressable//lib/addressable/uri.rb#34 class Addressable::URI::InvalidURIError < ::StandardError; end # source://addressable//lib/addressable/uri.rb#2572 Addressable::URI::NONE = T.let(T.unsafe(nil), Object) # source://addressable//lib/addressable/uri.rb#1523 Addressable::URI::NORMPATH = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/uri.rb#62 module Addressable::URI::NormalizeCharacterClasses; end # source://addressable//lib/addressable/uri.rb#67 Addressable::URI::NormalizeCharacterClasses::FRAGMENT = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/uri.rb#63 Addressable::URI::NormalizeCharacterClasses::HOST = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/uri.rb#65 Addressable::URI::NormalizeCharacterClasses::PCHAR = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/uri.rb#68 Addressable::URI::NormalizeCharacterClasses::QUERY = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/uri.rb#66 Addressable::URI::NormalizeCharacterClasses::SCHEME = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/uri.rb#64 Addressable::URI::NormalizeCharacterClasses::UNRESERVED = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/uri.rb#2401 Addressable::URI::PARENT = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#76 Addressable::URI::PORT_MAPPING = T.let(T.unsafe(nil), Hash) # source://addressable//lib/addressable/uri.rb#2403 Addressable::URI::RULE_2A = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/uri.rb#2404 Addressable::URI::RULE_2B_2C = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/uri.rb#2405 Addressable::URI::RULE_2D = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/uri.rb#2406 Addressable::URI::RULE_PREFIXED_PARENT = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/uri.rb#2400 Addressable::URI::SELF_REF = T.let(T.unsafe(nil), String) # Tables used to optimize encoding operations in `self.encode_component` # and `self.normalize_component` # # source://addressable//lib/addressable/uri.rb#347 Addressable::URI::SEQUENCE_ENCODING_TABLE = T.let(T.unsafe(nil), Hash) # source://addressable//lib/addressable/uri.rb#353 Addressable::URI::SEQUENCE_UPCASED_PERCENT_ENCODING_TABLE = T.let(T.unsafe(nil), Hash) # source://addressable//lib/addressable/uri.rb#71 Addressable::URI::SLASH = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/uri.rb#74 Addressable::URI::URIREGEX = T.let(T.unsafe(nil), Regexp) # source://addressable//lib/addressable/version.rb#23 module Addressable::VERSION; end # source://addressable//lib/addressable/version.rb#24 Addressable::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/version.rb#25 Addressable::VERSION::MINOR = T.let(T.unsafe(nil), Integer) # source://addressable//lib/addressable/version.rb#28 Addressable::VERSION::STRING = T.let(T.unsafe(nil), String) # source://addressable//lib/addressable/version.rb#26 Addressable::VERSION::TINY = T.let(T.unsafe(nil), Integer)