Sha256: c52a85736ae04e29d79b638245cba9fc38822349db1f3b6bcc7fd97f0c3ff4ef
Contents?: true
Size: 790 Bytes
Versions: 13
Compression:
Stored size: 790 Bytes
Contents
module Tests class Version def initialize(version) @version = Gem::Version.new(version.to_s + '') end def <(other_version) compare?(:<, other_version) end def <=(other_version) compare?(:<=, other_version) end def ==(other_version) compare?(:==, other_version) end def >=(other_version) compare?(:>=, other_version) end def >(other_version) compare?(:>, other_version) end def =~(other_version) Gem::Requirement.new(other_version).satisfied_by?(version) end def to_s version.to_s end protected attr_reader :version private def compare?(op, other_version) Gem::Requirement.new("#{op} #{other_version}").satisfied_by?(version) end end end
Version data entries
13 entries across 13 versions & 3 rubygems