Class: Dependabot::Elm::Requirement

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

Constant Summary collapse

ELM_PATTERN_RAW =
T.let(
  "(#{Elm::Version::VERSION_PATTERN}) (<=?) v (<=?) (#{Elm::Version::VERSION_PATTERN})".freeze,
  String
)
ELM_PATTERN =
/\A#{ELM_PATTERN_RAW}\z/
ELM_EXACT_PATTERN =
/\A#{Elm::Version::VERSION_PATTERN}\z/

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*requirements) ⇒ Requirement

Returns a new instance of Requirement.



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/dependabot/elm/requirement.rb', line 31

def initialize(*requirements)
  requirements = requirements.flatten.flat_map do |req_string|
    raise BadRequirementError, "Nil requirement not supported in Elm" if req_string.nil?

    req_string.split(",").map(&:strip).map do |r|
      convert_elm_constraint_to_ruby_constraint(r)
    end
  end

  super(requirements)
end

Class Method Details

.requirements_array(requirement_string) ⇒ Object



26
27
28
# File 'lib/dependabot/elm/requirement.rb', line 26

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

Instance Method Details

#satisfied_by?(version) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
47
# File 'lib/dependabot/elm/requirement.rb', line 44

def satisfied_by?(version)
  version = Elm::Version.new(version.to_s)
  super
end