Method: Bundler::RubyVersion#diff

Defined in:
lib/bundler/ruby_version.rb

#diff(other) ⇒ Object

Returns a tuple of these things:

[diff, this, other]
The priority of attributes are
1. engine
2. ruby_version
3. engine_version

Raises:

  • (ArgumentError)

93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/bundler/ruby_version.rb', line 93

def diff(other)
  raise ArgumentError, "Can only diff with a RubyVersion, not a #{other.class}" unless other.is_a?(RubyVersion)
  if engine != other.engine && @input_engine
    [:engine, engine, other.engine]
  elsif versions.empty? || !matches?(versions, other.gem_version)
    [:version, versions_string(versions), versions_string(other.versions)]
  elsif @input_engine && !matches?(engine_versions, other.engine_gem_version)
    [:engine_version, versions_string(engine_versions), versions_string(other.engine_versions)]
  elsif patchlevel && (!patchlevel.is_a?(String) || !other.patchlevel.is_a?(String) || !matches?(patchlevel, other.patchlevel))
    [:patchlevel, patchlevel, other.patchlevel]
  end
end