json2properties 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce4e12d23e2781e874254350edd145a45772dbc1
4
- data.tar.gz: 86585c38a402169b8f7d68dec5cca19df0969b8b
3
+ metadata.gz: 030e4ff931fa9a62d5264eed950a374de848f067
4
+ data.tar.gz: f76c1133f68400b65d7345ce86fa663384bd9b48
5
5
  SHA512:
6
- metadata.gz: b72d55af9793187ba60ba3b219cc29db1941816085221ba44c10c6dbf79bf80db77be6754bc88da45dee99fbf77f405316fbe891f5bccc7a18e4ff0a294de5a1
7
- data.tar.gz: b7d45b5e2c8647a220872e48f858ace322d24767467c3d4b7f8a617d5d2989230f1769b91508c6b8f8b012cf8ad8aeb6b7276f72bc98f7da0671865f82029f9e
6
+ metadata.gz: b2850ac8c31a8d2ae30cdf3c52a50ab9ede955baffe7a550e0df2b1333f58fcac6b0fb0e5570ed53eacf24ea91e19940257d41960be06e8090971c557ec6ef6c
7
+ data.tar.gz: 75e23f5c0c0bc637908cd80cb9e81b6dc2f5be76a2837f05b647a8290e39a50ca2941bb53c97f1cdd8b38a62d4d5a2a9ce80862ff973ce032aff7e4379f24e75
File without changes
@@ -12,10 +12,15 @@ class String
12
12
  return true if self.is_i?
13
13
  true if Float(self) rescue false
14
14
  end
15
+
16
+ def is_numeric_leading_zero?
17
+ self[0].eql?("0") && self.length > 1
18
+ end
19
+
15
20
  end
16
21
 
17
22
  class Json2properties
18
- VERSION = '0.0.2'
23
+ VERSION = '0.0.3'
19
24
  SEPARATOR = '.'
20
25
 
21
26
  def initialize
@@ -53,11 +58,11 @@ class Json2properties
53
58
  part = parts[i]
54
59
  next_part = parts[i+1]
55
60
 
56
- part = part.to_i if part.is_i?
61
+ part = part.to_i if ( part.is_i? && !part.is_numeric_leading_zero? )
57
62
  if tmp[part].nil?
58
63
  if next_part.nil?
59
64
  tmp[part] = fix_type(v)
60
- elsif next_part.is_i?
65
+ elsif next_part.is_i? && !next_part.is_numeric_leading_zero?
61
66
  tmp[part] = []
62
67
  else
63
68
  tmp[part] = {}
@@ -72,6 +77,7 @@ class Json2properties
72
77
  private
73
78
 
74
79
  def fix_type(v)
80
+ return v if v.is_numeric_leading_zero?
75
81
  return v.to_i if v.is_i?
76
82
  return v.to_f if v.is_numeric?
77
83
  return true if v == "true"
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json2properties
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartek Wilczek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-29 00:00:00.000000000 Z
11
+ date: 2016-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: java-properties