class Combustion::VersionGate

Attributes

name[R]

Public Class Methods

call(name, *constraints) click to toggle source
# File lib/combustion/version_gate.rb, line 7
def self.call(name, *constraints)
  new(name).call(*constraints)
end
new(name) click to toggle source
# File lib/combustion/version_gate.rb, line 11
def initialize(name)
  @name = name
end

Public Instance Methods

call(*constraints) click to toggle source

Using matches_spec? instead of match? because the former returns true even when the spec has an appropriate pre-release version.

# File lib/combustion/version_gate.rb, line 17
def call(*constraints)
  return false if spec.nil?

  dependency(*constraints).matches_spec?(spec)
end

Private Instance Methods

dependency(*constraints) click to toggle source
# File lib/combustion/version_gate.rb, line 27
def dependency(*constraints)
  Gem::Dependency.new(name, *constraints)
end
spec() click to toggle source
# File lib/combustion/version_gate.rb, line 31
def spec
  Gem.loaded_specs.fetch(name, nil)
end