Sha256: 8a46ee86ea74b04b7baddfc5c2faaa6acf61df5318da8738d68f5763f6e9c459
Contents?: true
Size: 826 Bytes
Versions: 4
Compression:
Stored size: 826 Bytes
Contents
# frozen_string_literal: true module Thinreports module Layout class Version COMPATIBLE_RULES = ['>= 0.8.0', '< 1.0.0'].freeze NEW_SCHEMA_FROM = '0.9.0'.freeze class << self def compatible_rules COMPATIBLE_RULES end end def initialize(schema_version) @schema_version = normalize_version(schema_version) end def compatible? self.class.compatible_rules.all? do |rule| op, ver = rule.split(' ') schema_version.send(op.to_sym, normalize_version(ver)) end end def legacy? @schema_version < normalize_version(NEW_SCHEMA_FROM) end private attr_reader :schema_version def normalize_version(version) Gem::Version.create(version) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems