Class: Dependabot::Devcontainers::Version

Inherits:
Version
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/devcontainers/version.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/dependabot/devcontainers/version.rb', line 35

def <=>(other)
  if self == other
    precision <=> other.precision
  else
    super
  end
end

#same_precision?(other) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/dependabot/devcontainers/version.rb', line 15

def same_precision?(other)
  precision == other.precision
end

#satisfies?(requirement) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/dependabot/devcontainers/version.rb', line 30

def satisfies?(requirement)
  requirement.satisfied_by?(self)
end

#truncate(target_precision) ⇒ Object



20
21
22
# File 'lib/dependabot/devcontainers/version.rb', line 20

def truncate(target_precision)
  T.cast(self.class.new(segments.first(target_precision).join(".")), Dependabot::Devcontainers::Version)
end

#truncate_to_precision_of(other) ⇒ Object



25
26
27
# File 'lib/dependabot/devcontainers/version.rb', line 25

def truncate_to_precision_of(other)
  truncate(other.precision)
end