Class: Kuby::Utils::SemVer::ConstraintSet

Inherits:
Object
  • Object
show all
Defined in:
lib/kuby/utils/sem_ver/constraint_set.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(constraints) ⇒ ConstraintSet

Returns a new instance of ConstraintSet.



11
12
13
# File 'lib/kuby/utils/sem_ver/constraint_set.rb', line 11

def initialize(constraints)
  @constraints = constraints
end

Instance Attribute Details

#constraintsObject (readonly)

Returns the value of attribute constraints.



5
6
7
# File 'lib/kuby/utils/sem_ver/constraint_set.rb', line 5

def constraints
  @constraints
end

Class Method Details

.parse(*arr) ⇒ Object



7
8
9
# File 'lib/kuby/utils/sem_ver/constraint_set.rb', line 7

def self.parse(*arr)
  new(arr.map { |c| Constraint.parse(c) })
end

Instance Method Details

#satisfied_by?(version) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/kuby/utils/sem_ver/constraint_set.rb', line 15

def satisfied_by?(version)
  constraints.all? { |c| c.satisfied_by?(version) }
end

#to_sObject



19
20
21
# File 'lib/kuby/utils/sem_ver/constraint_set.rb', line 19

def to_s
  @str ||= constraints.map(&:to_s).join(', ')
end