istox 0.3.7 → 0.3.8
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/istox/helpers/formatter.rb +3 -3
- data/lib/istox/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08ae3c962e156368285e8e07ea655d428b93310ab4137a370dd6ab95f7ac00cc'
|
4
|
+
data.tar.gz: 6f6c813fee420de9cd06e0175069e8f8f2e3b2d70eebe8e792962f3cac419190
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 534957ad873114132ca7fb35d79570f72c6020785d8bb7b71d7935fd98e6d2cb42d82166270dacdc6cf0f44dc8b649af80ec9724e2f022ce3646b0cbdf950a35
|
7
|
+
data.tar.gz: 945b8a9e2bf22dfccd62c2a0c7a3d38cf0c682c095d8ef28ddcfa66f74388e7891e31389b986c0351537cf061cb4c54c8ae789957d3f1492a349b65170b1071f
|
@@ -10,8 +10,8 @@ module Istox
|
|
10
10
|
input = ::BigDecimal.new(input.to_s).round(precision, round_mode)
|
11
11
|
|
12
12
|
input = input.abs if abs_num
|
13
|
-
|
14
|
-
result =
|
13
|
+
# result = format("%.#{precision}f", input) # may produce floating point error
|
14
|
+
result = (input.truncate(precision).to_s('F') + '000000000000000000')[/.*\..{#{precision}}/]
|
15
15
|
|
16
16
|
parts = result.to_s.split('.')
|
17
17
|
parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, '\\1,')
|
@@ -19,7 +19,7 @@ module Istox
|
|
19
19
|
end
|
20
20
|
|
21
21
|
# format a money, eg. 20000.134 > SGD 20,000.14, position can be :front or :behind, abs_num: whether to absolute the number
|
22
|
-
def money(input, round_mode: :half_up, precision: nil,
|
22
|
+
def money(input, currency:, round_mode: :half_up, precision: nil, position: :front, abs_num: false, hide_currency: false)
|
23
23
|
# precision = ::Istox::CommonHelper.get_currency_decimal(currency, precision)
|
24
24
|
|
25
25
|
decimal_place = if precision.present?
|
data/lib/istox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: istox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Siong Leng
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|
@@ -505,7 +505,7 @@ files:
|
|
505
505
|
homepage: http://www.abc.com
|
506
506
|
licenses: []
|
507
507
|
metadata: {}
|
508
|
-
post_install_message:
|
508
|
+
post_install_message:
|
509
509
|
rdoc_options: []
|
510
510
|
require_paths:
|
511
511
|
- lib
|
@@ -520,8 +520,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
520
520
|
- !ruby/object:Gem::Version
|
521
521
|
version: '0'
|
522
522
|
requirements: []
|
523
|
-
rubygems_version: 3.
|
524
|
-
signing_key:
|
523
|
+
rubygems_version: 3.0.6
|
524
|
+
signing_key:
|
525
525
|
specification_version: 4
|
526
526
|
summary: istox backend shared gem
|
527
527
|
test_files: []
|