friendly_numbers 0.4.0 → 0.5.0

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
- SHA1:
3
- metadata.gz: cc423e789c43c4e7b5c650ae51fd15993f6c478f
4
- data.tar.gz: 421d730d7e267fec4eea8f17499295ef8418bf54
2
+ SHA256:
3
+ metadata.gz: 433e9b8147e6f42996925ee4ac1d1f85700b262ec5ea9905c046bd68d7bfa59d
4
+ data.tar.gz: 8761157d53a90ac189e9af187cbea8a7e45feb4a947926c28bb09026e27845ee
5
5
  SHA512:
6
- metadata.gz: ac1fa9f9341bd851091bfeeaab13ed71b34f2008f9d8971b9ccd996c600f3a5f756e06018d0323c431bd8a0c93c983f6549bb81d1b169933316ba5eda3119a94
7
- data.tar.gz: 816710690f913be3dab54817bf7775f185e877b95a7f5b14af9a98dae411a8d7c63cd3d06064b30ead385130ecff9a536ab7eb86dfb982afb90a220507dad4be
6
+ metadata.gz: 1daf85daea83121b95608527169abac068464a65300e1ddcc33e958ea32d8d2cc1b06333acb652219ab409a2a3fc9d8339d04c5ab41fd9d2f026d66105f893c3
7
+ data.tar.gz: bfb873a0e78426deccd60b3e9c05ddf8199987558a36b439a4da93182530f9b444f108180f7a39cf9874769b33962e2431d3b41f5f3cd34cb18a3df78bf35879
@@ -0,0 +1,44 @@
1
+ # vim:ts=2:sts=2:sw=2:et:
2
+ ---
3
+ version: 2.0
4
+
5
+ jobs:
6
+ "ruby-2.4":
7
+ docker:
8
+ - image: circleci/ruby:2.4
9
+ steps:
10
+ - checkout
11
+ - run: gem install bundler -v 1.13 --no-document
12
+ - run: bundle install --path vendor/bundle
13
+ - run:
14
+ name: Run tests
15
+ command: rake test
16
+
17
+ "ruby-2.5":
18
+ docker:
19
+ - image: circleci/ruby:2.5
20
+ steps:
21
+ - checkout
22
+ - run: gem install bundler -v 1.13 --no-document
23
+ - run: bundle install --path vendor/bundle
24
+ - run:
25
+ name: Run tests
26
+ command: rake test
27
+
28
+ "ruby-2.6":
29
+ docker:
30
+ - image: circleci/ruby:2.6
31
+ steps:
32
+ - checkout
33
+ - run: bundle install --path vendor/bundle
34
+ - run:
35
+ name: Run tests
36
+ command: rake test
37
+
38
+ workflows:
39
+ version: 2
40
+ build:
41
+ jobs:
42
+ - "ruby-2.4"
43
+ - "ruby-2.5"
44
+ - "ruby-2.6"
@@ -1,5 +1,10 @@
1
1
  # master
2
2
 
3
+ # 0.5.0 (2019-03-28)
4
+ - Properly escape percent sign in percentage helper
5
+ - Fix handling of whole numbers in currency helper
6
+ - Fix decimal precision in currency helper
7
+
3
8
  # 0.4.0 (2017-11-16)
4
9
  - Ignore rational when passed to seconds_to_time
5
10
 
@@ -15,9 +15,11 @@ module FriendlyNumbers
15
15
 
16
16
  parted = partition(whole, options[:separator])
17
17
 
18
- options[:unit] +
19
- parted +
20
- format("%.#{options[:precision]}f", part)[1..-1] # Strip leading 0
18
+ if options[:precision].nonzero?
19
+ decimal = sprintf("%.0#{options[:precision]}f", part.abs)[1..-1] # Strip leading 0
20
+ end
21
+
22
+ options[:unit] + parted + decimal.to_s
21
23
  end
22
24
 
23
25
  def partition(whole, separator)
@@ -9,7 +9,7 @@ module FriendlyNumbers
9
9
  def convert(value, options) # :nodoc:
10
10
  options = DEFAULTS.merge(options)
11
11
 
12
- format("%.#{options[:precision]}f\%", value * 100)
12
+ format("%.#{options[:precision]}f%%", value * 100)
13
13
  end
14
14
  end
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module FriendlyNumbers
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: friendly_numbers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Daniels
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-16 00:00:00.000000000 Z
11
+ date: 2019-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -63,8 +63,8 @@ executables: []
63
63
  extensions: []
64
64
  extra_rdoc_files: []
65
65
  files:
66
+ - ".circleci/config.yml"
66
67
  - ".gitignore"
67
- - ".travis.yml"
68
68
  - CHANGELOG.md
69
69
  - Gemfile
70
70
  - LICENSE.txt
@@ -98,8 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
- rubyforge_project:
102
- rubygems_version: 2.5.2
101
+ rubygems_version: 3.0.1
103
102
  signing_key:
104
103
  specification_version: 4
105
104
  summary: Friendly number helpers for your non-Rails/Padrino apps.
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.4.0
5
- before_install: gem install bundler -v 1.13.7