Sha256: eeef478c03c774707731992afd7ed18ba523f0c2c23d1588af6ad3ec1f13ea9d
Contents?: true
Size: 823 Bytes
Versions: 3
Compression:
Stored size: 823 Bytes
Contents
module Snowglobe class GemVersion def initialize(version) @version = Gem::Version.new(version.to_s + "") end def major segments[0] end def minor segments[1] end def <(other) compare?(:<, other) end def <=(other) compare?(:<=, other) end def ==(other) compare?(:==, other) end def >=(other) compare?(:>=, other) end def >(other) compare?(:>, other) end def =~(other) Gem::Requirement.new(other).satisfied_by?(version) end def to_s version.to_s end private attr_reader :version def segments @_segments ||= version.to_s.split(".") end def compare?(op, other) Gem::Requirement.new("#{op} #{other}").satisfied_by?(version) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
snowglobe-0.3.0 | lib/snowglobe/gem_version.rb |
snowglobe-0.2.0 | lib/snowglobe/gem_version.rb |
snowglobe-0.1.0 | lib/snowglobe/gem_version.rb |