message_format 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -0
- data/lib/message_format/interpreter.rb +1 -1
- data/lib/message_format/version.rb +1 -1
- data/spec/message_format_spec.rb +7 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d658a9e2c2873f4d79b82d4e8d52c16ce8c5847813ea74a5fda309e79a506570
|
4
|
+
data.tar.gz: f6f08d3b64ff10dfb697803abdf68c02311fa90456a378d3134cfeee4915b2e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 451d356902caee5c79b4f694bb8547216ef74270ba71716bce06600dee1df3b88f3ed526c5a3b82069aa98e069c8a76516c95dfde19c73cddb72995e25165d3a
|
7
|
+
data.tar.gz: 5ef6bc98d8fdbf84224d7587f7754b472f2e70a6abeaa1c3b527ae63972908915440dc7ac99ca94a23a795805ae4ef06c0e2e28ab42fdd4ce90a259ed1436d28
|
data/CHANGELOG.md
CHANGED
@@ -84,7 +84,7 @@ module MessageFormat
|
|
84
84
|
lambda do |args|
|
85
85
|
number = TwitterCldr::Localized::LocalizedNumber.new(args[id] - offset, locale)
|
86
86
|
if style == 'integer'
|
87
|
-
number.to_decimal(:precision => 0)
|
87
|
+
number.to_decimal.to_s(:precision => 0)
|
88
88
|
elsif style == 'percent'
|
89
89
|
number.to_percent.to_s
|
90
90
|
elsif style == 'currency'
|
data/spec/message_format_spec.rb
CHANGED
@@ -47,6 +47,13 @@ describe MessageFormat do
|
|
47
47
|
expect(message).to match(/^0 \: \d\d?\/\d\d?\/\d{2,4} \d\d?\:\d\d [AP]M$/)
|
48
48
|
end
|
49
49
|
|
50
|
+
it 'formats integer number' do
|
51
|
+
pattern = '{ n, number, integer }'
|
52
|
+
message = MessageFormat.new(pattern, 'en-US').format({ n: 1234 })
|
53
|
+
|
54
|
+
expect(message).to match('1,234')
|
55
|
+
end
|
56
|
+
|
50
57
|
it 'handles plurals' do
|
51
58
|
pattern =
|
52
59
|
'On {takenDate, date, short} {name} {numPeople, plural, offset:1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: message_format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy VanWagoner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twitter_cldr
|
@@ -95,8 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
|
-
|
99
|
-
rubygems_version: 2.4.6
|
98
|
+
rubygems_version: 3.0.3
|
100
99
|
signing_key:
|
101
100
|
specification_version: 4
|
102
101
|
summary: Parse and format i18n messages using ICU MessageFormat patterns
|