Method: Addressable::URI#normalized_fragment

Defined in:
lib/addressable/uri.rb

#normalized_fragmentString

The fragment component for this URI, normalized.

Returns:

  • (String)

    The fragment component, normalized.



1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
# File 'lib/addressable/uri.rb', line 1816

def normalized_fragment
  return nil unless self.fragment
  return @normalized_fragment unless @normalized_fragment == NONE
  @normalized_fragment = begin
    component = Addressable::URI.normalize_component(
      self.fragment,
      Addressable::URI::NormalizeCharacterClasses::FRAGMENT
    )
    component == "" ? nil : component
  end
  # All normalized values should be UTF-8
  force_utf8_encoding_if_needed(@normalized_fragment)
  @normalized_fragment
end