Add protected reader for version value

This commit is contained in:
Jack Nagel 2015-03-17 21:37:03 -04:00
parent 03b309cc76
commit 68c7e1e30c

View File

@ -192,7 +192,7 @@ class Version
end end
def head? def head?
@version == 'HEAD' version == "HEAD"
end end
def <=>(other) def <=>(other)
@ -207,16 +207,18 @@ class Version
alias_method :eql?, :== alias_method :eql?, :==
def hash def hash
@version.hash version.hash
end end
def to_s def to_s
@version.dup version.dup
end end
alias_method :to_str, :to_s alias_method :to_str, :to_s
protected protected
attr_reader :version
def begins_with_numeric? def begins_with_numeric?
tokens.first.numeric? tokens.first.numeric?
end end
@ -236,7 +238,7 @@ class Version
end end
def tokenize def tokenize
@version.scan(SCAN_PATTERN).map! do |token| version.scan(SCAN_PATTERN).map! do |token|
case token case token
when /\A#{AlphaToken::PATTERN}\z/o then AlphaToken when /\A#{AlphaToken::PATTERN}\z/o then AlphaToken
when /\A#{BetaToken::PATTERN}\z/o then BetaToken when /\A#{BetaToken::PATTERN}\z/o then BetaToken