Class: Kuby::Utils::SemVer::ConstraintSet
- Inherits:
-
Object
- Object
- Kuby::Utils::SemVer::ConstraintSet
- Defined in:
- lib/kuby/utils/sem_ver/constraint_set.rb
Instance Attribute Summary collapse
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(constraints) ⇒ ConstraintSet
constructor
A new instance of ConstraintSet.
- #satisfied_by?(version) ⇒ Boolean
- #to_s ⇒ Object
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
#constraints ⇒ Object (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
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_s ⇒ Object
19 20 21 |
# File 'lib/kuby/utils/sem_ver/constraint_set.rb', line 19 def to_s @str ||= constraints.map(&:to_s).join(', ') end |