diff --git a/lib/librarian/dependency.rb b/lib/librarian/dependency.rb index ea8c8d93..01b3eed1 100644 --- a/lib/librarian/dependency.rb +++ b/lib/librarian/dependency.rb @@ -22,6 +22,12 @@ def ==(other) to_gem_requirement == other.to_gem_requirement end + alias :eql? :== + + def hash + self.to_s.hash + end + def to_s to_gem_requirement.to_s end diff --git a/lib/librarian/mock/source/mock.rb b/lib/librarian/mock/source/mock.rb index cfb77385..d1f4e325 100644 --- a/lib/librarian/mock/source/mock.rb +++ b/lib/librarian/mock/source/mock.rb @@ -30,6 +30,12 @@ def ==(other) self.name == other.name end + alias :eql? :== + + def hash + self.to_s.hash + end + def to_spec_args [name, {}] end diff --git a/lib/librarian/source/git.rb b/lib/librarian/source/git.rb index 2094989b..45496b41 100644 --- a/lib/librarian/source/git.rb +++ b/lib/librarian/source/git.rb @@ -52,6 +52,12 @@ def ==(other) (self.sha.nil? || other.sha.nil? || self.sha == other.sha) end + alias :eql? :== + + def hash + self.to_s.hash + end + def to_spec_args options = {} options.merge!(:ref => ref) if ref != DEFAULTS[:ref] diff --git a/lib/librarian/source/path.rb b/lib/librarian/source/path.rb index 0d03a712..0f9974ce 100644 --- a/lib/librarian/source/path.rb +++ b/lib/librarian/source/path.rb @@ -29,6 +29,12 @@ def ==(other) self.path == other.path end + alias :eql? :== + + def hash + self.to_s.hash + end + def to_spec_args [path.to_s, {}] end