lib/bundler/patch/advisory_consolidator.rb in bundler-patch-0.6.1 vs lib/bundler/patch/advisory_consolidator.rb in bundler-patch-0.7.0

- old
+ new

@@ -38,11 +38,11 @@ GemPatch.new(gem_name: up_spec.gem_name, old_version: old_version, new_version: new_version, patched_versions: up_spec.patched_versions) else GemPatch.new(gem_name: up_spec.gem_name, old_version: old_version, patched_versions: up_spec.patched_versions) end - end.partition { |gp| !gp.new_version.nil? } + end end private def consolidate_gemfiles(gemfiles) @@ -59,15 +59,29 @@ Gemfile.new(gem_name: all_gem_names.first, patched_versions: highest_minor_patched) end end class GemPatch + include Comparable + attr_reader :gem_name, :old_version, :new_version, :patched_versions def initialize(gem_name:, old_version: nil, new_version: nil, patched_versions: nil) @gem_name = gem_name - @old_version = old_version - @new_version = new_version + @old_version = Gem::Version.new(old_version) if old_version + @new_version = Gem::Version.new(new_version) if new_version @patched_versions = patched_versions + end + + def <=>(other) + self.gem_name <=> other.gem_name + end + + def hash + @gem_name.hash + end + + def eql?(other) + @gem_name.eql?(other.gem_name) end end end