class GitCompound::Repository::GitVersion
GitVersion
represents tagged version inside Git repository
Attributes
sha[R]
tag[R]
version[R]
Public Class Methods
new(tag, sha)
click to toggle source
# File lib/git_compound/repository/git_version.rb, line 8 def initialize(tag, sha) @tag = tag @sha = sha @version = tag.sub(/^v/, '') end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/git_compound/repository/git_version.rb, line 27 def <=>(other) to_gem_version <=> other.to_gem_version end
==(other)
click to toggle source
# File lib/git_compound/repository/git_version.rb, line 31 def ==(other) case other when String version == other when GitVersion version == other.version else false end end
matches?(requirement)
click to toggle source
# File lib/git_compound/repository/git_version.rb, line 22 def matches?(requirement) dependency = Gem::Dependency.new('component', requirement) dependency.match?('component', to_gem_version, true) end
to_gem_version()
click to toggle source
# File lib/git_compound/repository/git_version.rb, line 14 def to_gem_version Gem::Version.new(@version) end
valid?()
click to toggle source
# File lib/git_compound/repository/git_version.rb, line 18 def valid? @tag.match(/^v?#{Gem::Version::VERSION_PATTERN}$/) end