Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
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