singleton-ruby 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a1123e189882d4867128d6933adccda07f53b44ff5b9206ef4d90d6210cc8d7
4
- data.tar.gz: fa5d43b9fb1b15aab4008cf0d3fa6138137d96eed5eacb8b92c26c79d75f46a8
3
+ metadata.gz: f0abd7a01826bb75e0b2d1c652f8245992a31000d1e6da052e3ddd444aa56554
4
+ data.tar.gz: 8c7424f2b42ea4d16556111541f275998a09892967581269ef15ad66557a183c
5
5
  SHA512:
6
- metadata.gz: fe0b2657ce521442d0987728ce63993f27b928d618a55e8a9e0b020a632ae797c37fc8ad3316295c08292dc08b3d8a2a8f57a4581e2a8e143e10ecf312182e2d
7
- data.tar.gz: 2fe5be7449a0e5bcd2fa5b9264a35bd625e8987518539f78498ba07da09c6c3269eba4bdfe703b56a932b426c9ac68ac36ad43654866970944923ee097065eb2
6
+ metadata.gz: c8cf069e94dd35cd61b6ba833c2b3b7253eb214343deaeb036de2c8cdb1608154123ef38eddd14b1d515f3dbf085fa6ca3a06e924e94a2a61392b6c3ff8e1fce
7
+ data.tar.gz: 61d39ee45bb285a598fd67358be529541b32a79f55ec3c66e9e25e6dc730b8ceb89c9f0fbef1347233e7728abfd627afcb61c733dc0e7c572478788ee28de118
@@ -36,7 +36,15 @@ module SgtnClient
36
36
 
37
37
  def self.getString_f(component, key, args, locale)
38
38
  s = getString(component, key, locale)
39
- return sprintf s % args
39
+ if is_json?(args)
40
+ jsonstr = MultiJson.load(args)
41
+ jsonstr.each do |source, arg|
42
+ s.gsub! "{#{source}}", arg
43
+ end
44
+ elsif args.is_a?(Array)
45
+ s = sprintf s % args
46
+ end
47
+ return s
40
48
  end
41
49
 
42
50
  def self.getStrings(component, locale)
@@ -105,6 +113,13 @@ module SgtnClient
105
113
  return obj
106
114
  end
107
115
 
116
+ def self.is_json?(value)
117
+ result = MultiJson.load(value)
118
+ result.is_a?(Hash) || result.is_a?(Array)
119
+ rescue => exception
120
+ false
121
+ end
122
+
108
123
  end
109
124
 
110
125
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
 
2
- VERSION_INFO = [0, 1, 5].freeze
2
+ VERSION_INFO = [0, 1, 6].freeze
3
3
  VERSION = VERSION_INFO.map(&:to_s).join('.').freeze
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: singleton-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware G11n Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-27 00:00:00.000000000 Z
11
+ date: 2021-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client