YAVM 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yavm/version.rb +20 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56bc64875e0c991017a57cd0b3e994ad36eb4c45
|
4
|
+
data.tar.gz: 02d71dbe311990e921e68fc3b7e9f7129de18462
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68751c151d42bcf8bf5bb3e423ccf219c32654743f72f227b89a29d7389dd4c83c6eab3d40aa3b73e2070ed9defa28acb865e7b4c89eaa9c93843630fdaf93bc
|
7
|
+
data.tar.gz: 940bae764ac8ba2f4ff64908185547360384013c47b321301ea2d7c15e105a815a271d39cec0095c71c337f67f75c6c510634d1ba2c7f5d9c505a7a3bac65d46
|
data/lib/yavm/version.rb
CHANGED
@@ -20,16 +20,28 @@ module YAVM
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def special
|
24
|
+
empty_is_nil(:special)
|
25
|
+
end
|
26
|
+
|
27
|
+
def meta
|
28
|
+
empty_is_nil(:meta)
|
29
|
+
end
|
30
|
+
|
23
31
|
def to_s
|
24
32
|
format('%M.%m.%p%s')
|
25
33
|
end
|
26
34
|
|
27
35
|
def to_hash
|
28
|
-
@_version.marshal_dump
|
36
|
+
dump = @_version.marshal_dump
|
37
|
+
dump[:special] ||= ''
|
38
|
+
dump[:meta] ||= ''
|
39
|
+
|
40
|
+
return dump
|
29
41
|
end
|
30
42
|
|
31
43
|
def to_yaml
|
32
|
-
|
44
|
+
to_hash.to_yaml
|
33
45
|
end
|
34
46
|
|
35
47
|
def tag
|
@@ -58,6 +70,11 @@ module YAVM
|
|
58
70
|
|
59
71
|
private
|
60
72
|
|
73
|
+
def empty_is_nil(key)
|
74
|
+
value = @_version.send(key) || ''
|
75
|
+
value.empty? ? nil : value
|
76
|
+
end
|
77
|
+
|
61
78
|
def parse(string)
|
62
79
|
match = string.match(/\A(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(?:-(?<special>[a-z0-9]+))?(?:\+(?<meta>[a-z0-9]+))?\z/i)
|
63
80
|
|
@@ -81,7 +98,7 @@ module YAVM
|
|
81
98
|
# Allows calling "version.minor" and the like on the Version instance
|
82
99
|
#
|
83
100
|
def_delegators :@_version,
|
84
|
-
:major, :minor, :patch,
|
101
|
+
:major, :minor, :patch,
|
85
102
|
:major=, :minor=, :patch=, :special=, :meta=
|
86
103
|
|
87
104
|
end
|