tzispa_helpers 0.1.12 → 0.1.13
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/CHANGELOG.md +3 -0
- data/lib/tzispa/helpers/text.rb +9 -8
- data/lib/tzispa/helpers/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1cac0b3db825a145f5ac4cf36cc55de2cf347e5
|
4
|
+
data.tar.gz: 546bbaa7bab208bc61ffd83da025060f64f7507f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44ae86970acbe750caa3521cac83a6934d4eb3afef0b16878d86a19fe48124431e997b65a5a86713206bc42017ca2362ddd6688a60e988277a4c486999c0e9cd
|
7
|
+
data.tar.gz: 82405aafeeefa3db59d7a48d9e3decb916842ca2e65f5ddc6a5e4607d7f337b7234f646a816418cffcb198d5a6f3991e9a448bcb584585ed8163168962ea3c77
|
data/CHANGELOG.md
CHANGED
data/lib/tzispa/helpers/text.rb
CHANGED
@@ -98,8 +98,8 @@ module Tzispa
|
|
98
98
|
else
|
99
99
|
precision = options[:precision]
|
100
100
|
if precision
|
101
|
-
options[:minimum_precision] = precision
|
102
|
-
options[:maximum_precision] = precision
|
101
|
+
options[:minimum_precision] = precision unless options[:minimum_precision]
|
102
|
+
options[:maximum_precision] = precision unless options[:maximum_precision]
|
103
103
|
end
|
104
104
|
|
105
105
|
number = number.round if options[:round]
|
@@ -116,10 +116,11 @@ module Tzispa
|
|
116
116
|
fraction = fraction[0, options[:maximum_precision]] if options[:maximum_precision]
|
117
117
|
end
|
118
118
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
119
|
+
|
120
|
+
if fraction.length > 0 && minimum_precision > 0
|
121
|
+
fraction = "#{fraction}#{'0' * [0, minimum_precision - fraction.length].max}"
|
122
|
+
elsif minimum_precision == 0 && fraction.length > 0 && fraction.to_i == 0
|
123
|
+
fraction = ''
|
123
124
|
end
|
124
125
|
|
125
126
|
# the following two lines appear to be the most performant way to add a delimiter to every thousands place in the number
|
@@ -144,11 +145,11 @@ module Tzispa
|
|
144
145
|
end
|
145
146
|
|
146
147
|
def money_amount(number, options = {})
|
147
|
-
amount(number, options.merge(:unit => I18n.t('number.currency.format.unit'), :nil_as_dash =>
|
148
|
+
amount(number, options.merge(:unit => I18n.t('number.currency.format.unit'), :nil_as_dash => false, :precision => I18n.t('number.currency.format.precision'), minimum_precision: 0))
|
148
149
|
end
|
149
150
|
|
150
151
|
def price_amount(number, options = {})
|
151
|
-
amount(number, options.merge(:nil_as_dash =>
|
152
|
+
amount(number, options.merge(:nil_as_dash => false, :precision => I18n.t('number.currency.format.precision'), minimum_precision: 0))
|
152
153
|
end
|
153
154
|
|
154
155
|
def mime_formatter(text, mime)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tzispa_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Antonio Piñero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|