File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -223,6 +223,7 @@ def self.normalize_path(path)
223223 # @param [Boolean] validate (false)
224224 # @param [Boolean] canonicalize (false)
225225 def initialize ( *args , validate : false , canonicalize : false , **options )
226+ @value = @object = @hash = nil
226227 uri = args . first
227228 if uri
228229 @value = uri . to_s
@@ -795,7 +796,8 @@ def inspect
795796 # lexical representation of URI, either absolute or relative
796797 # @return [String]
797798 def value
798- @value ||= [
799+ return @value if @value
800+ @value = [
799801 ( "#{ scheme } :" if absolute? ) ,
800802 ( "//#{ authority } " if authority ) ,
801803 path ,
@@ -809,15 +811,15 @@ def value
809811 #
810812 # @return [Integer]
811813 def hash
812- @hash ||= ( value . hash * -1 )
814+ @hash || @hash = ( value . hash * -1 )
813815 end
814816
815817 ##
816818 # Returns object representation of this URI, broken into components
817819 #
818820 # @return [Hash{Symbol => String}]
819821 def object
820- @object ||= parse ( @value )
822+ @object || @object = parse ( @value )
821823 end
822824 alias_method :to_h , :object
823825
You can’t perform that action at this time.
0 commit comments