formatting 0.0.13 → 0.0.18
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 +5 -13
- data/.github/workflows/ci.yml +26 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +5 -0
- data/Gemfile +11 -1
- data/README.md +34 -8
- data/Rakefile +3 -1
- data/formatting.gemspec +8 -10
- data/lib/formatting/currency.rb +2 -0
- data/lib/formatting/number.rb +19 -11
- data/lib/formatting/percent.rb +28 -0
- data/lib/formatting/version.rb +3 -1
- data/lib/formatting.rb +4 -1
- data/spec/currency_spec.rb +11 -9
- data/spec/number_spec.rb +27 -6
- data/spec/percent_spec.rb +40 -0
- data/spec/spec_helper.rb +8 -0
- metadata +15 -52
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
OGU1OWE2YWY5Y2ZmMThjYTZhMDQzMzgyNDQ1ZDNiOTNkMTFmYmY5Yw==
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bc0d48715ff358482643c0ab965fcd3965399fb78eec281e109142917d0e249c
|
4
|
+
data.tar.gz: 74079c3f59a8f5c7e925ba627f1213c7956a7be5b5e23a7e0f5a9ad7dee19447
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YTdlMWMwOWZlNzI1Y2MzY2Q2MzUyMzNiMjIwOGYxMDg1MTdmYTEyMjgzZDgw
|
11
|
-
MzQ4NmRmMTY5MjU2OTY1ODJkNmFhOWEyOGJiOTNlZmE3NGI0YmQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
Yjc3MDk0NTY5YTM4ZmM5YWI1ZGM3ZTkyMTAzNTdiYmY3Y2UzNjk4YzhmNDUz
|
14
|
-
MjNlZDA3ODc3MzkzZmFkMTVmZTQ4MzQ3MDMwNzEwNTEwNzQ1MDQ2NWY5ZGVj
|
15
|
-
MTEzOTIxODkzYTJlMDc4ODFlYzAzNmI0Zjc5ZDJmNGU2NjIzOTk=
|
6
|
+
metadata.gz: 1fa29df5ceb15a52ff8630678295306dd88cc2de04f0aa2ca46bf2a636bfe56dcd0afd6fc7356ba68229e1c33ba7171bcdf6fe339bee209b7f407d44930aaf08
|
7
|
+
data.tar.gz: 5d43ba483c1d4b0c1e5805e70d6689242b8ff4261d8b4089372eac01115cb382a3f1cf147ad29c4667d35610cdba811a49be12d8173db58dd926c3a656349203
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby-version: ["3.0", "2.7", "2.6", "2.5"]
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
25
|
+
- name: Run tests
|
26
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in formatting.gemspec
|
4
6
|
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem "barsoom_utils", github: "barsoom/barsoom_utils"
|
10
|
+
gem "bundler"
|
11
|
+
gem "rake"
|
12
|
+
gem "rspec"
|
13
|
+
gem "rubocop"
|
14
|
+
end
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://github.com/barsoom/formatting/actions/workflows/ci.yml)
|
2
|
+
|
1
3
|
# Formatting
|
2
4
|
|
3
5
|
Rails-less formatting for your unit-testable code.
|
@@ -7,6 +9,7 @@ Will use the `i18n` library for formatting defaults if present, but it's not a r
|
|
7
9
|
Formats:
|
8
10
|
* Numbers
|
9
11
|
* Currency
|
12
|
+
* Percent
|
10
13
|
|
11
14
|
|
12
15
|
## Usage
|
@@ -25,6 +28,9 @@ format_number(1234) # => "1,234.00"
|
|
25
28
|
|
26
29
|
include Formatting::Currency
|
27
30
|
format_currency(item, :price) # => "1,234.00 SEK"
|
31
|
+
|
32
|
+
include Formatting::Percent
|
33
|
+
format_percent(12.3) # => "12.30%"
|
28
34
|
```
|
29
35
|
|
30
36
|
|
@@ -40,14 +46,16 @@ Formatting.format_number(1, explicit_sign: true) # => "+1.00"
|
|
40
46
|
|
41
47
|
#### Options
|
42
48
|
|
43
|
-
name
|
44
|
-
|
45
|
-
thousands_separator
|
46
|
-
decimal_separator
|
47
|
-
round
|
48
|
-
blank_when_zero
|
49
|
-
min_decimals
|
50
|
-
explicit_sign
|
49
|
+
name | default | explanation
|
50
|
+
-------------------------------|----------------------------------------------------------------------------------|------------
|
51
|
+
thousands_separator | `I18n.t("number.format.delimiter")` if available, otherwise a non-breaking space |
|
52
|
+
decimal_separator | `I18n.t("number.format.separator")` if available, otherwise `"."` |
|
53
|
+
round | `2` | Round to the given number of decimals. Don't round if given `false`.
|
54
|
+
blank_when_zero | `false` | If `true`, returns `""` for a zero value.
|
55
|
+
min_decimals | `2` | Show at least that number of decimals. Don't enforce if given `false`.
|
56
|
+
explicit_sign | `false` | If `true`, prefixes positive values with a `"+"`. Doesn't prefix `0`.
|
57
|
+
decimals_on_integers | `true` | If `false`, integers won't include decimals.
|
58
|
+
treat_zero_decimals_as_integer | `false` | If `true`, a zero value in the decimal column formats the number like an integer.
|
51
59
|
|
52
60
|
|
53
61
|
### Currency
|
@@ -82,6 +90,24 @@ format | `"<amount> <currency>"`
|
|
82
90
|
skip_currency | `false` | If `true`, doesn't add the currency to the amount.
|
83
91
|
|
84
92
|
|
93
|
+
### Percent
|
94
|
+
|
95
|
+
#### Example usage
|
96
|
+
|
97
|
+
``` ruby
|
98
|
+
Formatting.format_percent(12.3) # => "12.3%"
|
99
|
+
```
|
100
|
+
|
101
|
+
|
102
|
+
#### Options
|
103
|
+
|
104
|
+
Passes on all the number options and also takes these:
|
105
|
+
|
106
|
+
name | default | explanation
|
107
|
+
----------------|---------------------------------------------------|------------
|
108
|
+
format | `"<number>%"` or `<number> %` depending on locale | A format string.
|
109
|
+
|
110
|
+
|
85
111
|
## Installation
|
86
112
|
|
87
113
|
Add this line to your application's Gemfile:
|
data/Rakefile
CHANGED
data/formatting.gemspec
CHANGED
@@ -1,24 +1,22 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
+
require "formatting/version"
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = "formatting"
|
8
9
|
spec.version = Formatting::VERSION
|
9
|
-
spec.authors = ["Henrik Nyh", "Tomas Skogberg"]
|
10
|
-
spec.email = ["henrik@barsoom.se", "tomas@barsoom.se"]
|
10
|
+
spec.authors = [ "Henrik Nyh", "Tomas Skogberg" ]
|
11
|
+
spec.email = [ "henrik@barsoom.se", "tomas@barsoom.se" ]
|
11
12
|
spec.summary = %q{Rails-less formatting for your unit-testable code.}
|
12
13
|
spec.homepage = ""
|
13
14
|
spec.license = "MIT"
|
15
|
+
spec.metadata = { "rubygems_mfa_required" => "true" }
|
14
16
|
|
15
17
|
spec.files = `git ls-files`.split($/)
|
16
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
-
spec.require_paths = ["lib"]
|
19
|
+
spec.require_paths = [ "lib" ]
|
19
20
|
|
20
21
|
spec.add_dependency "attr_extras"
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
-
spec.add_development_dependency "rake"
|
23
|
-
spec.add_development_dependency "rspec"
|
24
22
|
end
|
data/lib/formatting/currency.rb
CHANGED
data/lib/formatting/number.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "attr_extras"
|
2
4
|
|
3
5
|
module Formatting
|
@@ -10,22 +12,28 @@ module Formatting
|
|
10
12
|
class FormatNumber
|
11
13
|
attr_private :input_number,
|
12
14
|
:thousands_separator, :decimal_separator,
|
13
|
-
:round, :min_decimals, :explicit_sign, :blank_when_zero
|
15
|
+
:round, :min_decimals, :decimals_on_integers, :treat_zero_decimals_as_integer, :explicit_sign, :blank_when_zero
|
14
16
|
|
15
17
|
def initialize(input_number, opts)
|
16
18
|
@input_number = input_number
|
17
19
|
|
18
|
-
@thousands_separator
|
19
|
-
@decimal_separator
|
20
|
-
@round
|
21
|
-
@min_decimals
|
22
|
-
@
|
23
|
-
@
|
20
|
+
@thousands_separator = opts.fetch(:thousands_separator) { default_thousands_separator }
|
21
|
+
@decimal_separator = opts.fetch(:decimal_separator) { default_decimal_separator }
|
22
|
+
@round = opts.fetch(:round, 2)
|
23
|
+
@min_decimals = opts.fetch(:min_decimals, 2)
|
24
|
+
@decimals_on_integers = opts.fetch(:decimals_on_integers, true)
|
25
|
+
@treat_zero_decimals_as_integer = opts.fetch(:treat_zero_decimals_as_integer, false)
|
26
|
+
@explicit_sign = opts.fetch(:explicit_sign, false)
|
27
|
+
@blank_when_zero = opts.fetch(:blank_when_zero, false)
|
24
28
|
end
|
25
29
|
|
26
30
|
def format
|
27
31
|
number = input_number
|
28
32
|
|
33
|
+
if treat_zero_decimals_as_integer && number.modulo(1).zero?
|
34
|
+
number = number.to_i
|
35
|
+
end
|
36
|
+
|
29
37
|
has_decimals = number.to_s.include?(".")
|
30
38
|
|
31
39
|
if blank_when_zero
|
@@ -33,7 +41,7 @@ module Formatting
|
|
33
41
|
end
|
34
42
|
|
35
43
|
# Avoid negative zero.
|
36
|
-
number =
|
44
|
+
number = number.abs if number.zero?
|
37
45
|
|
38
46
|
if round
|
39
47
|
number = number.round(round) if has_decimals
|
@@ -48,12 +56,12 @@ module Formatting
|
|
48
56
|
integer = "+#{integer}" if number > 0
|
49
57
|
end
|
50
58
|
|
51
|
-
if min_decimals
|
59
|
+
if min_decimals && (has_decimals || decimals_on_integers)
|
52
60
|
decimals ||= "0"
|
53
61
|
decimals = decimals.ljust(min_decimals, "0")
|
54
62
|
end
|
55
63
|
|
56
|
-
[integer, decimals].compact.join(decimal_separator)
|
64
|
+
[ integer, decimals ].compact.join(decimal_separator)
|
57
65
|
end
|
58
66
|
|
59
67
|
private
|
@@ -67,7 +75,7 @@ module Formatting
|
|
67
75
|
end
|
68
76
|
|
69
77
|
def t_format(key, default)
|
70
|
-
if defined?(I18n)
|
78
|
+
if defined?(I18n) && I18n.respond_to?(:t)
|
71
79
|
I18n.t(key, scope: "number.format", default: default)
|
72
80
|
else
|
73
81
|
default
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "attr_extras"
|
4
|
+
|
5
|
+
module Formatting
|
6
|
+
module Percent
|
7
|
+
def format_percent(number, opts = {})
|
8
|
+
format_string = opts.fetch(:format) { default_percent_format_string }
|
9
|
+
formatted_number = Formatting.format_number(number, opts)
|
10
|
+
format_string.gsub("<number>", formatted_number)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
# http://en.wikipedia.org/wiki/Percent_sign#Spacing
|
16
|
+
# Rails i18n doesn't have a conventional format string for this.
|
17
|
+
def default_percent_format_string
|
18
|
+
locale = defined?(I18n) && I18n.locale
|
19
|
+
|
20
|
+
case locale
|
21
|
+
when :sv, :fi, :fr, :de
|
22
|
+
"<number>#{Formatting::NON_BREAKING_SPACE}%"
|
23
|
+
else
|
24
|
+
"<number>%"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/formatting/version.rb
CHANGED
data/lib/formatting.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
# ^ so NON_BREAKING_SPACE is treated as UTF-8 in Ruby 1.9.
|
3
4
|
|
4
5
|
require "formatting/version"
|
5
6
|
require "formatting/number"
|
6
7
|
require "formatting/currency"
|
8
|
+
require "formatting/percent"
|
7
9
|
|
8
10
|
module Formatting
|
9
11
|
NON_BREAKING_SPACE = "\xc2\xa0"
|
10
12
|
|
11
13
|
extend Number
|
12
14
|
extend Currency
|
15
|
+
extend Percent
|
13
16
|
end
|
data/spec/currency_spec.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
|
-
describe Formatting::Currency do
|
5
|
+
RSpec.describe Formatting::Currency do
|
4
6
|
it "can be included as a module" do
|
5
7
|
object = Object.new
|
6
8
|
object.extend Formatting::Currency
|
@@ -8,7 +10,7 @@ describe Formatting::Currency do
|
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
11
|
-
describe Formatting do
|
13
|
+
RSpec.describe Formatting do
|
12
14
|
describe ".format_currency" do
|
13
15
|
let(:item) { double }
|
14
16
|
|
@@ -18,7 +20,7 @@ describe Formatting do
|
|
18
20
|
end
|
19
21
|
|
20
22
|
it "can take a record and a method name" do
|
21
|
-
item.
|
23
|
+
allow(item).to receive(:price).and_return(2)
|
22
24
|
expect_formatted(item, :price).to eq space_to_nbsp("2.00")
|
23
25
|
end
|
24
26
|
|
@@ -48,12 +50,12 @@ describe Formatting do
|
|
48
50
|
end
|
49
51
|
|
50
52
|
it "is read from the record's #currency if present" do
|
51
|
-
item.
|
53
|
+
allow(item).to receive(:currency).and_return("SEK")
|
52
54
|
expect_formatted(item, 1).to eq space_to_nbsp("1.00 SEK")
|
53
55
|
end
|
54
56
|
|
55
57
|
it "is not added if the record's #currency is blank" do
|
56
|
-
item.
|
58
|
+
allow(item).to receive(:currency).and_return("")
|
57
59
|
expect_formatted(item, 1).to eq space_to_nbsp("1.00")
|
58
60
|
end
|
59
61
|
|
@@ -68,8 +70,8 @@ describe Formatting do
|
|
68
70
|
|
69
71
|
context "format string option" do
|
70
72
|
it "is used if provided" do
|
71
|
-
expect_formatted(item, 123, format: "C: <currency> A: <amount>", currency: "XYZ")
|
72
|
-
to eq space_to_nbsp("C: XYZ A: 123.00")
|
73
|
+
expect_formatted(item, 123, format: "C: <currency> A: <amount>", currency: "XYZ")
|
74
|
+
.to eq space_to_nbsp("C: XYZ A: 123.00")
|
73
75
|
end
|
74
76
|
|
75
77
|
it "will have spaces turned into non-breaking spaces" do
|
@@ -79,8 +81,8 @@ describe Formatting do
|
|
79
81
|
end
|
80
82
|
|
81
83
|
it "is stripped" do
|
82
|
-
expect_formatted(item, 123, format: "<amount> <currency>", currency: nil)
|
83
|
-
to eq space_to_nbsp("123.00")
|
84
|
+
expect_formatted(item, 123, format: "<amount> <currency>", currency: nil)
|
85
|
+
.to eq space_to_nbsp("123.00")
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
data/spec/number_spec.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
|
-
describe Formatting::Number do
|
5
|
+
RSpec.describe Formatting::Number do
|
4
6
|
it "can be included as a module" do
|
5
7
|
object = Object.new
|
6
8
|
object.extend Formatting::Number
|
@@ -8,7 +10,7 @@ describe Formatting::Number do
|
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
11
|
-
describe Formatting do
|
13
|
+
RSpec.describe Formatting do
|
12
14
|
describe ".format_number" do
|
13
15
|
it "formats a number" do
|
14
16
|
expect_formatted(1234567.89).to eq space_to_nbsp("1 234 567.89")
|
@@ -25,9 +27,9 @@ describe Formatting do
|
|
25
27
|
|
26
28
|
it "uses I18n.t('number.format.delimiter') if present" do
|
27
29
|
allow(i18n).to receive(:t).with(:separator, instance_of(Hash))
|
28
|
-
expect(i18n).to receive(:t)
|
29
|
-
with(:delimiter, scope: "number.format", default: space_to_nbsp(" "))
|
30
|
-
and_return(";")
|
30
|
+
expect(i18n).to receive(:t)
|
31
|
+
.with(:delimiter, scope: "number.format", default: space_to_nbsp(" "))
|
32
|
+
.and_return(";")
|
31
33
|
expect_formatted(1234).to include "1;234"
|
32
34
|
end
|
33
35
|
end
|
@@ -90,7 +92,6 @@ describe Formatting do
|
|
90
92
|
end
|
91
93
|
end
|
92
94
|
|
93
|
-
|
94
95
|
context "minimum number of decimals" do
|
95
96
|
it "defaults to two decimals" do
|
96
97
|
expect_formatted(12).to eq "12.00"
|
@@ -110,6 +111,26 @@ describe Formatting do
|
|
110
111
|
end
|
111
112
|
end
|
112
113
|
|
114
|
+
context "decimals on integers" do
|
115
|
+
it "defaults to adding decimals" do
|
116
|
+
expect_formatted(12).to eq "12.00"
|
117
|
+
end
|
118
|
+
|
119
|
+
it "can be turned off" do
|
120
|
+
expect_formatted(12, decimals_on_integers: false).to eq "12"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context "treat_zero_decimals_as_integer" do
|
125
|
+
it "defaults to false" do
|
126
|
+
expect_formatted(12.0, decimals_on_integers: false).to eq "12.00"
|
127
|
+
end
|
128
|
+
|
129
|
+
it "can be turned off" do
|
130
|
+
expect_formatted(12.0, decimals_on_integers: false, treat_zero_decimals_as_integer: true).to eq "12"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
113
134
|
context "explicit sign" do
|
114
135
|
it "is not included by default" do
|
115
136
|
expect_formatted(1).to eq "1.00"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
RSpec.describe Formatting::Percent do
|
6
|
+
it "can be included as a module" do
|
7
|
+
object = Object.new
|
8
|
+
object.extend Formatting::Percent
|
9
|
+
expect(object).to respond_to(:format_percent)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
RSpec.describe Formatting, ".format_percent" do
|
14
|
+
it "formats a number" do
|
15
|
+
expect_formatted(1.2).to eq "1.20%"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "passes on number formatting options" do
|
19
|
+
expect_formatted(1.567, round: 1).to include "1.6"
|
20
|
+
end
|
21
|
+
|
22
|
+
context "format string option" do
|
23
|
+
it "is used if provided" do
|
24
|
+
expect_formatted(1, format: "%<number>%").to eq "%1.00%"
|
25
|
+
end
|
26
|
+
|
27
|
+
context "if I18n.locale is available" do
|
28
|
+
let(:i18n) { stub_const("I18n", double) }
|
29
|
+
|
30
|
+
it "defaults sensibly for some locales that require spacing the sign" do
|
31
|
+
allow(i18n).to receive(:locale).and_return(:sv)
|
32
|
+
expect_formatted(1).to eq space_to_nbsp("1.00 %")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def expect_formatted(number, opts = {})
|
38
|
+
expect(Formatting.format_percent(number, opts))
|
39
|
+
end
|
40
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "formatting"
|
2
4
|
|
3
5
|
module Helpers
|
@@ -8,4 +10,10 @@ end
|
|
8
10
|
|
9
11
|
RSpec.configure do |config|
|
10
12
|
config.include Helpers
|
13
|
+
|
14
|
+
config.example_status_persistence_file_path = ".rspec_results"
|
15
|
+
config.disable_monkey_patching!
|
16
|
+
|
17
|
+
config.order = :random
|
18
|
+
Kernel.srand config.seed
|
11
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formatting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Nyh
|
@@ -9,62 +9,20 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: attr_extras
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: bundler
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '1.3'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ~>
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '1.3'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: rake
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ! '>='
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ! '>='
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: rspec
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ! '>='
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
25
|
+
- - ">="
|
68
26
|
- !ruby/object:Gem::Version
|
69
27
|
version: '0'
|
70
28
|
description:
|
@@ -75,7 +33,9 @@ executables: []
|
|
75
33
|
extensions: []
|
76
34
|
extra_rdoc_files: []
|
77
35
|
files:
|
78
|
-
- .
|
36
|
+
- ".github/workflows/ci.yml"
|
37
|
+
- ".gitignore"
|
38
|
+
- ".rubocop.yml"
|
79
39
|
- Gemfile
|
80
40
|
- LICENSE.txt
|
81
41
|
- README.md
|
@@ -84,35 +44,38 @@ files:
|
|
84
44
|
- lib/formatting.rb
|
85
45
|
- lib/formatting/currency.rb
|
86
46
|
- lib/formatting/number.rb
|
47
|
+
- lib/formatting/percent.rb
|
87
48
|
- lib/formatting/version.rb
|
88
49
|
- spec/currency_spec.rb
|
89
50
|
- spec/number_spec.rb
|
51
|
+
- spec/percent_spec.rb
|
90
52
|
- spec/spec_helper.rb
|
91
53
|
homepage: ''
|
92
54
|
licenses:
|
93
55
|
- MIT
|
94
|
-
metadata:
|
56
|
+
metadata:
|
57
|
+
rubygems_mfa_required: 'true'
|
95
58
|
post_install_message:
|
96
59
|
rdoc_options: []
|
97
60
|
require_paths:
|
98
61
|
- lib
|
99
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|
100
63
|
requirements:
|
101
|
-
- -
|
64
|
+
- - ">="
|
102
65
|
- !ruby/object:Gem::Version
|
103
66
|
version: '0'
|
104
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
68
|
requirements:
|
106
|
-
- -
|
69
|
+
- - ">="
|
107
70
|
- !ruby/object:Gem::Version
|
108
71
|
version: '0'
|
109
72
|
requirements: []
|
110
|
-
|
111
|
-
rubygems_version: 2.2.1
|
73
|
+
rubygems_version: 3.2.31
|
112
74
|
signing_key:
|
113
75
|
specification_version: 4
|
114
76
|
summary: Rails-less formatting for your unit-testable code.
|
115
77
|
test_files:
|
116
78
|
- spec/currency_spec.rb
|
117
79
|
- spec/number_spec.rb
|
80
|
+
- spec/percent_spec.rb
|
118
81
|
- spec/spec_helper.rb
|