singleton-ruby 0.1.9 → 0.2.0

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: 8b9a86b24b35f77b5d2abea8686d2ab8a9819ea5e5b4957e6997234262d4cc24
4
- data.tar.gz: 9328b24f10c0a97a77cc6b7168fdadedc9b3a935b7c54409b260d9c03440d7fc
3
+ metadata.gz: e74b238c58ac91cb373e48cd664ef4c8115bbb811b8ceb0427a82979b5d6bdfe
4
+ data.tar.gz: ae96f56fd84a59d82ce60d9aceea55baac70bc2004c1d87d00f94dee6a9ff2a0
5
5
  SHA512:
6
- metadata.gz: cec4722423baf395e872eef3e07c444ec4c3001e6b86b50fab653782ed460e3504fd2145445970fedf3f62332c0f4c8384cd54794eeb8069f91bcf9baf16b29e
7
- data.tar.gz: ce55d5ee39549d7137b095e3541200d6d26c2fd26ae0fdaf594bf2aaacf3cfca8b11c680be2973d9bda1fff1ba5416fa5a8a0d21544439f5fdc4b92451cdc581
6
+ metadata.gz: bae2bb630c92a26d5fc84141fda89193d48d373fefa8c1a48090cac524fc485cc0a80ee1de0076ca56e577a69e3774ace36d1ede442828a4025294a113c88223
7
+ data.tar.gz: 713f0b37a528eb1c1f5e1c50519985d7821b2fac1182912194a3f7ef17e09671a38ec34c073109d46edbe939e3ade572d1ef433a642e1dcbffdd79cd45b48116
@@ -19,7 +19,8 @@ module SgtnClient
19
19
  end
20
20
  if items.nil? || items[locale][key].nil?
21
21
  SgtnClient.logger.debug "Source not found, return key: " + key
22
- return key
22
+ #return key
23
+ return nil
23
24
  else
24
25
  return items[locale][key]
25
26
  end
@@ -1,27 +1,63 @@
1
1
  require 'date'
2
2
  require 'time'
3
3
 
4
- DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
5
- def l_full_s(locale = TwitterCldr.locale)
6
- self.localize(locale).to_full_s
4
+ DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 2
5
+ def l_full_s(locale = TwitterCldr.locale, *args)
6
+ timezone = args[0]
7
+ display_name = args[1]
8
+ if timezone.nil?
9
+ self.localize(locale).to_full_s
10
+ elsif display_name.nil?
11
+ self.localize(locale).with_timezone(timezone).to_full_s
12
+ else
13
+ tz = TwitterCldr::Timezones::Timezone.instance(timezone, locale)
14
+ tz.display_name_for(self, display_name)
15
+ end
7
16
  end
8
17
  LOCALIZE
9
18
 
10
19
  DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
11
- def l_long_s(locale = TwitterCldr.locale)
12
- self.localize(locale).to_long_s
20
+ def l_long_s(locale = TwitterCldr.locale, *args)
21
+ timezone = args[0]
22
+ display_name = args[1]
23
+ if timezone.nil?
24
+ self.localize(locale).to_long_s
25
+ elsif display_name.nil?
26
+ self.localize(locale).with_timezone(timezone).to_long_s
27
+ else
28
+ tz = TwitterCldr::Timezones::Timezone.instance(timezone, locale)
29
+ tz.display_name_for(self, display_name)
30
+ end
13
31
  end
14
32
  LOCALIZE
15
33
 
16
34
  DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
17
- def l_medium_s(locale = TwitterCldr.locale)
18
- self.localize(locale).to_medium_s
35
+ def l_medium_s(locale = TwitterCldr.locale, *args)
36
+ timezone = args[0]
37
+ display_name = args[1]
38
+ if timezone.nil?
39
+ self.localize(locale).to_medium_s
40
+ elsif display_name.nil?
41
+ self.localize(locale).with_timezone(timezone).to_medium_s
42
+ else
43
+ tz = TwitterCldr::Timezones::Timezone.instance(timezone, locale)
44
+ tz.display_name_for(self, display_name)
45
+ end
19
46
  end
20
47
  LOCALIZE
21
48
 
22
49
 
23
50
  DateTime.class_eval <<-LOCALIZE, __FILE__, __LINE__ + 1
24
- def l_short_s(locale = TwitterCldr.locale)
25
- self.localize(locale).to_short_s
51
+ def l_short_s(locale = TwitterCldr.locale, *args)
52
+ timezone = args[0]
53
+ display_name = args[1]
54
+ if timezone.nil?
55
+ self.localize(locale).to_short_s
56
+ elsif display_name.nil?
57
+ self.localize(locale).with_timezone(timezone).to_short_s
58
+ else
59
+ tz = TwitterCldr::Timezones::Timezone.instance(timezone, locale)
60
+ tz.display_name_for(self, display_name)
61
+ end
26
62
  end
27
63
  LOCALIZE
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
 
2
- VERSION_INFO = [0, 1, 9].freeze
2
+ VERSION_INFO = [0, 2, 0].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.9
4
+ version: 0.2.0
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-11-18 00:00:00.000000000 Z
11
+ date: 2021-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client