Class: Dependabot::Composer::Requirement
- Inherits:
 - 
      Requirement
      
        
- Object
 - Requirement
 - Dependabot::Composer::Requirement
 
 
- Extended by:
 - T::Sig
 
- Defined in:
 - lib/dependabot/composer/requirement.rb
 
Constant Summary collapse
- AND_SEPARATOR =
 /(?<=[a-zA-Z0-9*])(?<!\sas)[\s,]+(?![\s,]*[|-]|as)/- OR_SEPARATOR =
 /(?<=[a-zA-Z0-9*])[\s,]*\|\|?\s*/
Class Method Summary collapse
Instance Method Summary collapse
- 
  
    
      #initialize(*requirements)  ⇒ Requirement 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Requirement.
 
Constructor Details
#initialize(*requirements) ⇒ Requirement
Returns a new instance of Requirement.
      33 34 35 36 37 38 39 40  | 
    
      # File 'lib/dependabot/composer/requirement.rb', line 33 def initialize(*requirements) requirements = requirements.flatten .flat_map { |req_string| req_string.split(AND_SEPARATOR) } .flat_map { |req| convert_php_constraint_to_ruby_constraint(req) } super(requirements) end  | 
  
Class Method Details
.parse(obj) ⇒ Object
      17 18 19 20 21 22  | 
    
      # File 'lib/dependabot/composer/requirement.rb', line 17 def self.parse(obj) new_obj = obj.gsub(/@\w+/, "").gsub(/[a-z0-9\-_\.]*\sas\s+/i, "") return DefaultRequirement if new_obj == "" super(new_obj) end  | 
  
.requirements_array(requirement_string) ⇒ Object
      27 28 29 30 31  | 
    
      # File 'lib/dependabot/composer/requirement.rb', line 27 def self.requirements_array(requirement_string) T.must(requirement_string).strip.split(OR_SEPARATOR).map do |req_string| new(req_string) end end  |