plurimath 0.8.6 → 0.8.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 455b8c76b3f3b81de7fb64404dd70294107831a5af4fdde9b2acf2505895ec73
|
4
|
+
data.tar.gz: b1f196c6c295a5eae38e537e5a2ca9bc495895ea9eafa0784e2085116e71e36e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b1d2f6056126c677dda6cd5003c7d530009aab799e86b2a382736d8019b6f68652a3b0a050b61d8fb5e751b62c23db3fd0daa5e82dd8c499b4bf8eee140718a
|
7
|
+
data.tar.gz: 45a364fbf46f1c78e6e5c7507891b3c9a2b47cac2460e775f8c01487e6fce33d993d6282f19002b76605f42b0894f8fff8dcb6da9076632747d8d03c4bfd1389
|
@@ -8,7 +8,7 @@ require_relative "localized_number"
|
|
8
8
|
module Plurimath
|
9
9
|
module Formatter
|
10
10
|
class NumericFormatter
|
11
|
-
attr_accessor :locale, :localize_number, :localizer_symbols
|
11
|
+
attr_accessor :locale, :localize_number, :localizer_symbols, :twitter_cldr_reader
|
12
12
|
|
13
13
|
LOCALIZE_NUMBER_REGEX = %r{(?<group>[^#])?(?<groupdigits>#+0)(?<decimal>.)(?<fractdigits>#+)(?<fractgroup>[^#])?}
|
14
14
|
SUPPORTED_NOTATIONS = %i[e scientific engineering].freeze
|
@@ -17,7 +17,7 @@ module Plurimath
|
|
17
17
|
@locale = locale
|
18
18
|
@localize_number = localize_number
|
19
19
|
@localizer_symbols = localizer_symbols
|
20
|
-
@twitter_cldr_reader =
|
20
|
+
@twitter_cldr_reader = twitter_cldr_reader_lookup
|
21
21
|
end
|
22
22
|
|
23
23
|
def localized_number(number_string, locale:, precision:, format:)
|
@@ -30,7 +30,7 @@ module Plurimath
|
|
30
30
|
|
31
31
|
private
|
32
32
|
|
33
|
-
def
|
33
|
+
def twitter_cldr_reader_lookup
|
34
34
|
num = TwitterCldr::DataReaders::NumberDataReader.new(locale)
|
35
35
|
num.symbols
|
36
36
|
.merge!(@localizer_symbols)
|
@@ -50,7 +50,6 @@ module Plurimath
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def localize_number(num)
|
53
|
-
num = num.match?(/\./) ? num.to_f : num.to_i
|
54
53
|
localized = localize(BigDecimal(num.to_s))
|
55
54
|
return localized.to_s if @precision.zero?
|
56
55
|
|
@@ -23,6 +23,14 @@ module Plurimath
|
|
23
23
|
)
|
24
24
|
end
|
25
25
|
|
26
|
+
def twitter_cldr_reader(locale: @locale)
|
27
|
+
Formatter::NumericFormatter.new(
|
28
|
+
supported_locale(locale),
|
29
|
+
localize_number: localize_number,
|
30
|
+
localizer_symbols: localizer_symbols,
|
31
|
+
).twitter_cldr_reader
|
32
|
+
end
|
33
|
+
|
26
34
|
private
|
27
35
|
|
28
36
|
def supported_locale(locale)
|
data/lib/plurimath/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plurimath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twitter_cldr
|