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.
Methods inherited from String
Constructor Details
#initialize(version) ⇒ Version
Create a new version object.
81 82 83 84 |
# File 'lib/chef/sugar/constraints.rb', line 81 def initialize(version) super @version = Gem::Version.new(version) end |
Instance Method Details
#satisfies?(*constraints) ⇒ Boolean
Determine if the given constraint is satisfied by this version.
102 103 104 |
# File 'lib/chef/sugar/constraints.rb', line 102 def satisfies?(*constraints) Gem::Requirement.new(*constraints).satisfied_by?(@version) end |