Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundler/lib/bundler/lazy_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def eql?(other)
end

def hash
identifier.hash
@__hash ||= identifier.hash
Comment thread
deivid-rodriguez marked this conversation as resolved.
end

##
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/plugin/api/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def ==(other)
# docstring for `==` method, i.e. two methods equal by above comparison
# should have same hash.
def hash
[self.class, uri].hash
@__hash = [self.class, uri].hash
end

# A helper method, not necessary if not used internally.
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/resolver/spec_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def eql?(other)
end

def hash
name.hash ^ version.hash ^ sorted_activated_platforms.hash ^ source.hash
@__hash ||= name.hash ^ version.hash ^ sorted_activated_platforms.hash ^ source.hash
end

protected
Expand Down
10 changes: 6 additions & 4 deletions bundler/lib/bundler/rubygems_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,12 @@ def _with_sorted_requirements
class Requirement
module CorrectHashForLambdaOperator
def hash
if requirements.any? {|r| r.first == "~>" }
requirements.map {|r| r.first == "~>" ? [r[0], r[1].to_s] : r }.sort.hash
else
super
@__hash ||= begin
if requirements.any? {|r| r.first == "~>" }
requirements.map {|r| r.first == "~>" ? [r[0], r[1].to_s] : r }.sort.hash
else
super
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/source/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def to_lock
end

def hash
[self.class, uri, ref, branch, name, version, glob, submodules].hash
@__hash ||= [self.class, uri, ref, branch, name, version, glob, submodules].hash
end

def eql?(other)
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/source/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def ==(other)
alias_method :eql?, :==

def hash
self.class.hash
@__hash ||= self.class.hash
end

def version_message(spec)
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/source/path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def to_s
end

def hash
[self.class, expanded_path, version].hash
@__hash ||= [self.class, expanded_path, version].hash
end

def eql?(other)
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/source/rubygems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def cached!
end

def hash
@remotes.hash
@__hash ||= @remotes.hash
end

def eql?(other)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def shallow_eql?(other)

# @return [Fixnum] a hash for the vertex based upon its {#name}
def hash
name.hash
@__hash ||= name.hash
end

# Is there a path from `self` to `other` following edges in the
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/vendor/uri/lib/uri/generic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ def ==(oth)
end

def hash
self.component_ary.hash
@__hash ||= self.component_ary.hash
end

def eql?(oth)
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/dependency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def initialize(name, *requirements)
# and +requirement+.

def hash # :nodoc:
name.hash ^ type.hash ^ requirement.hash
@__hash ||= name.hash ^ type.hash ^ requirement.hash
end

def inspect # :nodoc:
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/name_tuple.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ def ==(other)
alias_method :eql?, :==

def hash
to_a.hash
@__hash ||= to_a.hash
end
end
2 changes: 1 addition & 1 deletion lib/rubygems/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def ==(other)
alias :eql? :==

def hash # :nodoc:
to_a.hash
@__hash ||= to_a.hash
end

##
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/requirement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def as_list # :nodoc:
end

def hash # :nodoc:
requirements.map {|r| r.first == "~>" ? [r[0], r[1].to_s] : r }.sort.hash
@__hash ||= requirements.map {|r| r.first == "~>" ? [r[0], r[1].to_s] : r }.sort.hash
end

def marshal_dump # :nodoc:
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/resolver/activation_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def eql?(other)
end

def hash
@spec.hash
@__hash ||= @spec.hash
end

##
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/resolver/api_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def ==(other) # :nodoc:
end

def hash
@set.hash ^ @name.hash ^ @version.hash ^ @platform.hash
@__hash ||= @set.hash ^ @name.hash ^ @version.hash ^ @platform.hash
end

def fetch_development_dependencies # :nodoc:
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/resolver/index_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def ==(other)
end

def hash
@name.hash ^ @version.hash ^ @platform.hash
@__hash ||= @name.hash ^ @version.hash ^ @platform.hash
end

def inspect # :nodoc:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def shallow_eql?(other)

# @return [Fixnum] a hash for the vertex based upon its {#name}
def hash
name.hash
@__hash ||= name.hash
end

# Is there a path from `self` to `other` following edges in the
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def dependency_resolver_set # :nodoc:
end

def hash # :nodoc:
@uri.hash
@__hash ||= @uri.hash
end

##
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/source/lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def ==(other) # :nodoc:
end

def hash # :nodoc:
@wrapped.hash ^ 3
@__hash ||= @wrapped.hash ^ 3
end

##
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,7 @@ def has_unit_tests? # :nodoc:
# :startdoc:

def hash # :nodoc:
name.hash ^ version.hash
@__hash ||= name.hash ^ version.hash
end

def init_with(coder) # :nodoc:
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def eql?(other)
end

def hash # :nodoc:
canonical_segments.hash
@__hash ||= canonical_segments.hash
end

def init_with(coder) # :nodoc:
Expand Down