Class: Chef::Sugar::Constraints::Constraint
- Defined in:
- lib/chef/sugar/constraints.rb
Overview
This class is a wrapper around a version requirement that adds a nice DSL for comparing constraints:
Instance Method Summary collapse
-
#initialize(*constraints) ⇒ Constraint
constructor
Create a new constraint object.
-
#satisfied_by?(version) ⇒ Boolean
Determine if the given version string is satisfied by this constraint or group of constraints.
Constructor Details
#initialize(*constraints) ⇒ Constraint
Create a new constraint object.
37 38 39 |
# File 'lib/chef/sugar/constraints.rb', line 37 def initialize(*constraints) @requirement = Gem::Requirement.new(*constraints) end |
Instance Method Details
#satisfied_by?(version) ⇒ Boolean
Determine if the given version string is satisfied by this constraint or group of constraints.
58 59 60 |
# File 'lib/chef/sugar/constraints.rb', line 58 def satisfied_by?(version) @requirement.satisfied_by?(Gem::Version.new(version)) end |