Commit edea0a11 authored by Fabio Pelosin's avatar Fabio Pelosin

[Version] Updated #to_s and added Version.from_s.

parent 584c2b3c
......@@ -447,13 +447,7 @@ module Pod
end
def to_s
if !version
name
elsif version.head?
"#{name} (HEAD from #{version})"
else
"#{name} (#{version})"
end
version ? "#{name} (#{version})" : name
end
def inspect
......
module Pod
class Version < Gem::Version
# @returns A Version described by its #to_s method.
#
def self.from_s(string)
match = string.match(/HEAD from (.*)/)
string = match[1] if match
vers = Version.new(string)
vers.head = true if match
vers
end
attr_accessor :head
alias_method :head?, :head
def to_s
head? ? "HEAD from #{super}" : super
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment