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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c9e90c4a0d59d4da52d3a5c693b92b5c8f826904
4
- data.tar.gz: 6b6a93d8e42d509db39d9c43ba3123fffcd86a98
3
+ metadata.gz: e1cac0b3db825a145f5ac4cf36cc55de2cf347e5
4
+ data.tar.gz: 546bbaa7bab208bc61ffd83da025060f64f7507f
5
5
  SHA512:
6
- metadata.gz: 9a08e4ce57c6480997a9dfaa1e521f9724410f535cfb637336466fdeb08fe50ade6903391256b4aeb89f0dbce88954f0c5e56dff3c94e163ec3125002994c6c7
7
- data.tar.gz: 23539f0d011a06c82cd1bd197b23e00b3f13fe1fa935fce197332c7a6fdea16216265f621dabb5028296c80117cebab9771d434cff87592a7d6f421561ec26ec
6
+ metadata.gz: 44ae86970acbe750caa3521cac83a6934d4eb3afef0b16878d86a19fe48124431e997b65a5a86713206bc42017ca2362ddd6688a60e988277a4c486999c0e9cd
7
+ data.tar.gz: 82405aafeeefa3db59d7a48d9e3decb916842ca2e65f5ddc6a5e4607d7f337b7234f646a816418cffcb198d5a6f3991e9a448bcb584585ed8163168962ea3c77
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  Tzispa Helpers
2
2
 
3
+ ## v0.1.13
4
+ - amount minimum precision 0 discards fraction part
5
+
3
6
  ## v0.1.12
4
7
  - minimal securize crawler_save_file verifying url
5
8
 
@@ -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
- if minimum_precision > 0
120
- if fraction.length > 0 || minimum_precision > 0
121
- fraction = "#{fraction}#{'0' * [0, minimum_precision - fraction.length].max}"
122
- end
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 => true, :precision => I18n.t('number.currency.format.precision')))
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 => true, :precision => I18n.t('number.currency.format.precision')))
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)
@@ -3,7 +3,7 @@
3
3
  module Tzispa
4
4
  module Helpers
5
5
 
6
- VERSION = '0.1.12'
6
+ VERSION = '0.1.13'
7
7
  NAME = 'Tzispa Helpers'
8
8
  GEM_NAME = 'tzispa_helpers'
9
9
 
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.12
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-26 00:00:00.000000000 Z
11
+ date: 2016-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail