plurimath 0.9.4 → 0.9.5
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 +4 -4
- data/lib/plurimath/formatter/numbers/fraction.rb +11 -8
- data/lib/plurimath/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7394b4bc80e849dee8177592843aa9c9d45787e990262fc5697d98cff5dce430
|
4
|
+
data.tar.gz: 8ffee0aa744fa4e78be377477b7a4469ff83955da1496c8c1e6b758f2301e03a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b63df23644a7b5a726a20d860f2f372a0afd0e00cfcc75f0a189b125895c3eeaa2fed6100ae284a185a6691e80a787dd8a5653554f2f71f6b60c33e46f70786
|
7
|
+
data.tar.gz: cd2c261d539cb96cbe8f7aa7d01167b0e88a6de619859e6fa6ce71facb61a685ca58ea91bb71920514aa895a92f1083cd6cfc29646cb49a15b18362dc4790f80
|
@@ -18,8 +18,12 @@ module Plurimath
|
|
18
18
|
precision = options[:precision] || @precision
|
19
19
|
return "" unless precision > 0
|
20
20
|
|
21
|
-
number =
|
22
|
-
|
21
|
+
number = if @digit_count
|
22
|
+
digit_count_format(int, fraction)
|
23
|
+
else
|
24
|
+
format(fraction, precision)
|
25
|
+
end
|
26
|
+
|
23
27
|
formatted_number = change_format(number) if number
|
24
28
|
formatted_number ? decimal + formatted_number : ""
|
25
29
|
end
|
@@ -40,18 +44,17 @@ module Plurimath
|
|
40
44
|
tokens.compact.join(separator)
|
41
45
|
end
|
42
46
|
|
43
|
-
def digit_count_format(int, fraction
|
47
|
+
def digit_count_format(int, fraction)
|
44
48
|
integer = int + "." + fraction
|
45
|
-
|
46
|
-
int_length = integer.length - 1
|
49
|
+
int_length = integer.length - 1 # integer length; excluding the decimal point
|
47
50
|
@digit_count ||= int_length
|
48
51
|
if int_length > @digit_count
|
49
|
-
number_string =
|
52
|
+
number_string = BigDecimal(integer).round(@digit_count - int.length)
|
50
53
|
numeric_digits(number_string) if @digit_count > int.length
|
51
54
|
elsif int_length < @digit_count
|
52
|
-
|
55
|
+
fraction + ("0" * (update_digit_count(fraction) - int_length))
|
53
56
|
else
|
54
|
-
|
57
|
+
fraction
|
55
58
|
end
|
56
59
|
end
|
57
60
|
|
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.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ox
|