YAVM 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/yavm/version.rb +20 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f61250eb85d9a2e91c9e678d3a778af73077f1c
4
- data.tar.gz: ce292887c4595dbeb3076e714dfe02aadebff7fa
3
+ metadata.gz: 56bc64875e0c991017a57cd0b3e994ad36eb4c45
4
+ data.tar.gz: 02d71dbe311990e921e68fc3b7e9f7129de18462
5
5
  SHA512:
6
- metadata.gz: 8807b0ea3cfd119a4e50230f0fb8622216d2c5f7522975599f14338fa116bdda25a0f9743f6bd68283f026ba4fea174384b638cdda4593e942e0b00e8c92378e
7
- data.tar.gz: dc0afe74765d1e989fb5a39f5e18d48bc29fa20cbb20d52009b71b4c4f57afaccad86398b1c8e4c70b56dbda374ed5c952637f541bd32b84515ba43585a97fa9
6
+ metadata.gz: 68751c151d42bcf8bf5bb3e423ccf219c32654743f72f227b89a29d7389dd4c83c6eab3d40aa3b73e2070ed9defa28acb865e7b4c89eaa9c93843630fdaf93bc
7
+ data.tar.gz: 940bae764ac8ba2f4ff64908185547360384013c47b321301ea2d7c15e105a815a271d39cec0095c71c337f67f75c6c510634d1ba2c7f5d9c505a7a3bac65d46
@@ -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
- @_version.marshal_dump.to_yaml
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, :special, :meta,
101
+ :major, :minor, :patch,
85
102
  :major=, :minor=, :patch=, :special=, :meta=
86
103
 
87
104
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: YAVM
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lewis Eason