Class: Dependabot::Bundler::Requirement

Inherits:
Requirement
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/bundler/requirement.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*requirements) ⇒ Requirement

Patches Gem::Requirement to make it accept requirement strings like “~> 4.2.5, >= 4.2.5.1” without first needing to split them.



29
30
31
32
33
34
35
# File 'lib/dependabot/bundler/requirement.rb', line 29

def initialize(*requirements)
  requirements = requirements.flatten.flat_map do |req_string|
    req_string.split(",").map(&:strip)
  end

  super(requirements)
end

Class Method Details

.requirements_array(requirement_string) ⇒ Object



23
24
25
# File 'lib/dependabot/bundler/requirement.rb', line 23

def self.requirements_array(requirement_string)
  [new(requirement_string)]
end

.satisfied_by?(req, version) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/dependabot/bundler/requirement.rb', line 15

def self.satisfied_by?(req, version)
  new(req[:requirement]).satisfied_by?(version)
end