Sha256: 718fd8cc852ca11ad0e7a62b804492f1efddda0e272a81cdb0e1b80ed04f45c1
Contents?: true
Size: 952 Bytes
Versions: 3
Compression:
Stored size: 952 Bytes
Contents
# coding: utf-8 module Thinreports module Layout module Version REQUIRED_RULES = ['>= 0.7.7.0', '< 1.0.0'] # @param [String] version # @return [Boolean] def self.compatible?(version) compare(version, *REQUIRED_RULES) end # @param [String] base # @param [Array<String>] rules # @return [Boolean] def self.compare(base, *rules) rules.all? do |rule| op, ver = rule.split(' ') comparable_version(base).send(op.to_sym, comparable_version(ver)) end end # @return [String] def self.inspect_required_rules '(' + REQUIRED_RULES.join(' and ') + ')' end # @param [String] version # @return [String] def self.comparable_version(version) if version =~ /pre/ version.sub(/pre(\d*)$/) { $1 == '' ? '1' : $1 } else "#{version}.99" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
thinreports-0.8.2 | lib/thinreports/layout/version.rb |
thinreports-0.8.1 | lib/thinreports/layout/version.rb |
thinreports-0.8.0 | lib/thinreports/layout/version.rb |