Sha256: 641771929963e008c62eb4af8632dcd6fe5f607a60c92e947da105d4c70ca5d9
Contents?: true
Size: 1.4 KB
Versions: 5
Compression:
Stored size: 1.4 KB
Contents
# # Copyright 2013-2014, Seth Vargo <sethvargo@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # require_relative '../constraints' class String # # Treat strings as version objects. # # @see Chef::Sugar::Constraints::Version # # @example Using pure string objects like versions # '1.2.3'.satisfies?('~> 1.2.0') # # @param [String, Array<String>] constraints # the list of constraints to satisfy # def satisfies?(*constraints) Chef::Sugar::Constraints::Version.new(dup).satisfies?(*constraints) end # # Treat strings as version constraints. # # @see Chef::Sugar::Constraints::Constraint # # @example Using pure string objects like constraints # '~> 1.2.0'.satisfied_by?('1.2.3') # # @param [String] version # the version to check if it is satisfied # def satisfied_by?(version) Chef::Sugar::Constraints::Constraint.new(dup).satisfied_by?(version) end end
Version data entries
5 entries across 5 versions & 1 rubygems