Class: Chef::Sugar::Constraints::Version
- Defined in:
- lib/chef/sugar/constraints.rb
Overview
This class exposes a single version constraint object that wraps the string representation of a version string and proved helpful comparator methods.
Instance Method Summary collapse
-
#initialize(version) ⇒ Version
constructor
Create a new version object.
-
#satisfies?(*constraints) ⇒ Boolean
Determine if the given constraint is satisfied by this version.
Constructor Details
#initialize(version) ⇒ Version
Create a new version object.
109 110 111 |
# File 'lib/chef/sugar/constraints.rb', line 109 def initialize(version) @version = Gem::Version.new(version) end |
Instance Method Details
#satisfies?(*constraints) ⇒ Boolean
Determine if the given constraint is satisfied by this version.
129 130 131 |
# File 'lib/chef/sugar/constraints.rb', line 129 def satisfies?(*constraints) Gem::Requirement.new(*constraints).satisfied_by?(@version) end |