def fragment=(new_fragment)
      if new_fragment && !new_fragment.respond_to?(:to_str)
        raise TypeError, "Can't convert #{new_fragment.class} into String."
      end
      @fragment = new_fragment ? new_fragment.to_str : nil

      # Reset dependent values
      remove_instance_variable(:@normalized_fragment) if defined?(@normalized_fragment)
      remove_composite_values

      # Ensure we haven't created an invalid URI
      validate()
    end
def fragment=(new_fragment)
      if new_fragment && !new_fragment.respond_to?(:to_str)
        raise TypeError, "Can't convert #{new_fragment.class} into String."
      end
      @fragment = new_fragment ? new_fragment.to_str : nil

      # Reset dependent values
      remove_instance_variable(:@normalized_fragment) if defined?(@normalized_fragment)
      remove_composite_values

      # Ensure we haven't created an invalid URI
      validate()
    end
Sets the fragment component for this URI.

 @param [String, #to_str] new_fragment The new fragment component.