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 ...@@ -447,13 +447,7 @@ module Pod
end end
def to_s def to_s
if !version version ? "#{name} (#{version})" : name
name
elsif version.head?
"#{name} (HEAD from #{version})"
else
"#{name} (#{version})"
end
end end
def inspect def inspect
......
module Pod module Pod
class Version < Gem::Version 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 attr_accessor :head
alias_method :head?, :head alias_method :head?, :head
def to_s
head? ? "HEAD from #{super}" : super
end
end 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