splittable 0.0.6 → 0.0.7
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/.github/workflows/publish_release.yml +11 -4
- data/.github/workflows/ruby.yml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +4 -21
- data/.ruby-version +1 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile +4 -4
- data/Gemfile.lock +67 -54
- data/README.md +16 -8
- data/lib/splittable/version.rb +1 -1
- data/splittable.gemspec +5 -4
- metadata +9 -12
- data/sonar-project.properties +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1ce195bb6bf78672483d4823042006672922a3de448b313c3229c765e6acc54
|
4
|
+
data.tar.gz: 4d7dbcb92fc8345afcf92637741e68dc8a9cd349cc97e63f80fb66eb916c40da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33eb4933330ff1020bfc37e8a971273ec825bc6f17c64dbdf8d6825c056db25faeab0683aea256022887fabc524b07df19fe850d79e820df194dee3d37c61281
|
7
|
+
data.tar.gz: ec8f776bc35bb3c5abe8e887ccc6edd07da873d2f0eabbf9925bdbcf6732eba1188dcb5060f5912c6faedbea934879b4691d990338c3e7d22b38807acbf16a2a
|
@@ -13,13 +13,20 @@ jobs:
|
|
13
13
|
runs-on: ubuntu-latest
|
14
14
|
|
15
15
|
steps:
|
16
|
-
- uses: actions/checkout@
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
|
18
|
+
- name: Set up Ruby version specified in `.ruby-version`
|
19
|
+
with:
|
20
|
+
ruby-version: .ruby-version
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
|
23
|
+
- name: Install dependencies
|
24
|
+
run: bundle install --jobs 4 --retry 3
|
17
25
|
|
18
26
|
- name: Release Gem
|
19
|
-
uses:
|
27
|
+
uses: m4rcelotoledo/publish-rubygems-action@master
|
20
28
|
env:
|
21
|
-
GITHUB_TOKEN: ${{secrets.BUNDLE_GITHUB__COM}}
|
22
29
|
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_RELEASE}}
|
23
|
-
GIT_EMAIL: automated_release@
|
30
|
+
GIT_EMAIL: automated_release@gmail.com
|
24
31
|
GIT_NAME: 'Automated Release'
|
25
32
|
RELEASE_COMMAND: bundle exec rake release
|
data/.github/workflows/ruby.yml
CHANGED
@@ -12,15 +12,15 @@ jobs:
|
|
12
12
|
runs-on: ubuntu-latest
|
13
13
|
strategy:
|
14
14
|
matrix:
|
15
|
-
ruby: [ '
|
15
|
+
ruby: [ '3.4.6' ]
|
16
16
|
|
17
17
|
steps:
|
18
|
-
- uses: actions/checkout@
|
18
|
+
- uses: actions/checkout@v3
|
19
19
|
|
20
20
|
- name: Set up Ruby version specified in `.ruby-version`
|
21
21
|
with:
|
22
|
-
ruby-version:
|
23
|
-
uses:
|
22
|
+
ruby-version: .ruby-version
|
23
|
+
uses: ruby/setup-ruby@v1
|
24
24
|
|
25
25
|
- name: Install dependencies
|
26
26
|
run: bundle install --jobs 4 --retry 3
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
1
|
+
plugins:
|
2
2
|
- rubocop-performance
|
3
3
|
- rubocop-rake
|
4
4
|
- rubocop-rspec
|
5
5
|
|
6
6
|
AllCops:
|
7
7
|
NewCops: enable
|
8
|
-
TargetRubyVersion:
|
8
|
+
TargetRubyVersion: 3.4
|
9
9
|
Exclude:
|
10
10
|
- 'Rakefile'
|
11
11
|
- 'bin/**/*'
|
@@ -18,17 +18,9 @@ Gemspec/RequiredRubyVersion:
|
|
18
18
|
Layout/DotPosition:
|
19
19
|
EnforcedStyle: trailing
|
20
20
|
|
21
|
-
Layout/SpaceAroundMethodCallOperator:
|
22
|
-
Enabled: true
|
23
|
-
|
24
|
-
Lint/RaiseException:
|
25
|
-
Enabled: true
|
26
|
-
|
27
|
-
Lint/StructNewOverride:
|
28
|
-
Enabled: true
|
29
|
-
|
30
21
|
Metrics/BlockLength:
|
31
|
-
|
22
|
+
Exclude:
|
23
|
+
- test/**/*
|
32
24
|
|
33
25
|
RSpec/ExampleLength:
|
34
26
|
Enabled: false
|
@@ -44,12 +36,3 @@ Style/Documentation:
|
|
44
36
|
|
45
37
|
Style/ExponentialNotation:
|
46
38
|
Enabled: false
|
47
|
-
|
48
|
-
Style/HashEachMethods:
|
49
|
-
Enabled: true
|
50
|
-
|
51
|
-
Style/HashTransformKeys:
|
52
|
-
Enabled: true
|
53
|
-
|
54
|
-
Style/HashTransformValues:
|
55
|
-
Enabled: true
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.4.6
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -4,10 +4,10 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
-
gem 'bigdecimal'
|
8
|
-
gem 'pry-byebug'
|
9
|
-
gem 'rake'
|
10
|
-
gem 'rspec'
|
7
|
+
gem 'bigdecimal'
|
8
|
+
gem 'pry-byebug'
|
9
|
+
gem 'rake'
|
10
|
+
gem 'rspec'
|
11
11
|
|
12
12
|
group :development, :test do
|
13
13
|
gem 'rubocop', require: false
|
data/Gemfile.lock
CHANGED
@@ -1,80 +1,93 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
splittable (0.0.
|
4
|
+
splittable (0.0.7)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
ast (2.4.
|
10
|
-
bigdecimal (3.
|
11
|
-
byebug (
|
9
|
+
ast (2.4.3)
|
10
|
+
bigdecimal (3.3.1)
|
11
|
+
byebug (12.0.0)
|
12
12
|
coderay (1.1.3)
|
13
|
-
diff-lcs (1.
|
14
|
-
docile (1.
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
diff-lcs (1.6.2)
|
14
|
+
docile (1.4.1)
|
15
|
+
json (2.15.1)
|
16
|
+
language_server-protocol (3.17.0.5)
|
17
|
+
lint_roller (1.1.0)
|
18
|
+
method_source (1.1.0)
|
19
|
+
parallel (1.27.0)
|
20
|
+
parser (3.3.9.0)
|
18
21
|
ast (~> 2.4.1)
|
19
|
-
|
22
|
+
racc
|
23
|
+
prism (1.5.2)
|
24
|
+
pry (0.15.2)
|
20
25
|
coderay (~> 1.1)
|
21
26
|
method_source (~> 1.0)
|
22
|
-
pry-byebug (3.
|
23
|
-
byebug (~>
|
24
|
-
pry (
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
rspec (3.
|
30
|
-
rspec-core (~> 3.
|
31
|
-
rspec-expectations (~> 3.
|
32
|
-
rspec-mocks (~> 3.
|
33
|
-
rspec-core (3.
|
34
|
-
rspec-support (~> 3.
|
35
|
-
rspec-expectations (3.
|
27
|
+
pry-byebug (3.11.0)
|
28
|
+
byebug (~> 12.0)
|
29
|
+
pry (>= 0.13, < 0.16)
|
30
|
+
racc (1.8.1)
|
31
|
+
rainbow (3.1.1)
|
32
|
+
rake (13.3.0)
|
33
|
+
regexp_parser (2.11.3)
|
34
|
+
rspec (3.13.1)
|
35
|
+
rspec-core (~> 3.13.0)
|
36
|
+
rspec-expectations (~> 3.13.0)
|
37
|
+
rspec-mocks (~> 3.13.0)
|
38
|
+
rspec-core (3.13.5)
|
39
|
+
rspec-support (~> 3.13.0)
|
40
|
+
rspec-expectations (3.13.5)
|
36
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-mocks (3.
|
42
|
+
rspec-support (~> 3.13.0)
|
43
|
+
rspec-mocks (3.13.5)
|
39
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-support (3.
|
42
|
-
rubocop (1.
|
45
|
+
rspec-support (~> 3.13.0)
|
46
|
+
rspec-support (3.13.6)
|
47
|
+
rubocop (1.81.1)
|
48
|
+
json (~> 2.3)
|
49
|
+
language_server-protocol (~> 3.17.0.2)
|
50
|
+
lint_roller (~> 1.1.0)
|
43
51
|
parallel (~> 1.10)
|
44
|
-
parser (>= 3.
|
52
|
+
parser (>= 3.3.0.2)
|
45
53
|
rainbow (>= 2.2.2, < 4.0)
|
46
|
-
regexp_parser (>=
|
47
|
-
|
48
|
-
rubocop-ast (>= 1.2.0, < 2.0)
|
54
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
55
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
49
56
|
ruby-progressbar (~> 1.7)
|
50
|
-
unicode-display_width (>=
|
51
|
-
rubocop-ast (1.
|
52
|
-
parser (>=
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
rubocop
|
58
|
-
rubocop-
|
59
|
-
|
60
|
-
rubocop
|
61
|
-
|
62
|
-
|
57
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
58
|
+
rubocop-ast (1.47.1)
|
59
|
+
parser (>= 3.3.7.2)
|
60
|
+
prism (~> 1.4)
|
61
|
+
rubocop-performance (1.26.0)
|
62
|
+
lint_roller (~> 1.1)
|
63
|
+
rubocop (>= 1.75.0, < 2.0)
|
64
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
65
|
+
rubocop-rake (0.7.1)
|
66
|
+
lint_roller (~> 1.1)
|
67
|
+
rubocop (>= 1.72.1)
|
68
|
+
rubocop-rspec (3.7.0)
|
69
|
+
lint_roller (~> 1.1)
|
70
|
+
rubocop (~> 1.72, >= 1.72.1)
|
71
|
+
ruby-progressbar (1.13.0)
|
72
|
+
simplecov (0.22.0)
|
63
73
|
docile (~> 1.1)
|
64
74
|
simplecov-html (~> 0.11)
|
65
75
|
simplecov_json_formatter (~> 0.1)
|
66
|
-
simplecov-html (0.
|
67
|
-
simplecov_json_formatter (0.1.
|
68
|
-
unicode-display_width (2.0
|
76
|
+
simplecov-html (0.13.2)
|
77
|
+
simplecov_json_formatter (0.1.4)
|
78
|
+
unicode-display_width (3.2.0)
|
79
|
+
unicode-emoji (~> 4.1)
|
80
|
+
unicode-emoji (4.1.0)
|
69
81
|
|
70
82
|
PLATFORMS
|
71
83
|
ruby
|
84
|
+
x86_64-linux
|
72
85
|
|
73
86
|
DEPENDENCIES
|
74
|
-
bigdecimal
|
75
|
-
pry-byebug
|
76
|
-
rake
|
77
|
-
rspec
|
87
|
+
bigdecimal
|
88
|
+
pry-byebug
|
89
|
+
rake
|
90
|
+
rspec
|
78
91
|
rubocop
|
79
92
|
rubocop-performance
|
80
93
|
rubocop-rake
|
@@ -83,4 +96,4 @@ DEPENDENCIES
|
|
83
96
|
splittable!
|
84
97
|
|
85
98
|
BUNDLED WITH
|
86
|
-
2.2
|
99
|
+
2.7.2
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Splittable
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/splittable)
|
4
|
-
[](https://github.com/m4rcelotoledo/splittable/actions?query=workflow%3ARuby)
|
5
5
|
|
6
6
|
## Goal
|
7
7
|
|
@@ -36,13 +36,13 @@ Result: the total truncated value was divided by the number of plots informed an
|
|
36
36
|
```ruby
|
37
37
|
=> [0.5e-1, 0.3e-1, 0.3e-1] # => [0.05, 0.03, 0.03]
|
38
38
|
```
|
39
|
-
Default precision is 2 decimal places, but, you can customize this with precision parameter:
|
39
|
+
Default precision is 2 decimal places, but, you can customize this with precision parameter:
|
40
40
|
|
41
41
|
``` ruby
|
42
42
|
Splittable.division(value: 10, quantity: 3, precision: 3)
|
43
43
|
```
|
44
44
|
|
45
|
-
Result:
|
45
|
+
Result:
|
46
46
|
```ruby
|
47
47
|
=> [0.3334e1, 0.3333e1, 0.3333e1] # => [0.334, 0.333, 0.333]
|
48
48
|
```
|
@@ -60,12 +60,12 @@ Result: all values are truncated and them the difference is attributed in the fi
|
|
60
60
|
=> [0.3524e2, 0.2143e2, 0.4333e2] # => [35.24, 21.43, 43.33]
|
61
61
|
```
|
62
62
|
|
63
|
-
In this method, you have the same optional precision parameter:
|
63
|
+
In this method, you have the same optional precision parameter:
|
64
64
|
```ruby
|
65
65
|
Splittable.normalize(value: 100, installments: [33.33333333, 33.33333333, 33.33333333], precision: 3)
|
66
66
|
```
|
67
67
|
|
68
|
-
Result:
|
68
|
+
Result:
|
69
69
|
```ruby
|
70
70
|
=> [0.33334e2, 0.33333e2, 0.33333e2] # => [33.334, 33.333, 33.333]
|
71
71
|
```
|
@@ -74,12 +74,20 @@ Result:
|
|
74
74
|
|
75
75
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
76
76
|
|
77
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
77
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
78
|
+
|
79
|
+
## To Release
|
80
|
+
|
81
|
+
Fill the `CHANGELOG.md` with relevants update.
|
82
|
+
|
83
|
+
To automatic release a new version, update the version number in `lib/splittable/version.rb` and merge it to `master` branch.
|
84
|
+
|
85
|
+
To manual release update the version and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
78
86
|
|
79
87
|
## Contributing
|
80
88
|
|
81
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
89
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/m4rcelotoledo/splittable/blob/master/CONTRIBUTING.md.
|
82
90
|
|
83
91
|
## Code of Conduct
|
84
92
|
|
85
|
-
Welcome on GitHub at https://github.com/
|
93
|
+
Welcome on GitHub at https://github.com/m4rcelotoledo/splittable/blob/master/CODE_OF_CONDUCT.md.
|
data/lib/splittable/version.rb
CHANGED
data/splittable.gemspec
CHANGED
@@ -15,12 +15,13 @@ Gem::Specification.new do |spec|
|
|
15
15
|
where the result must be presented in cents, that is converting the
|
16
16
|
division result to only two decimal places and the difference is
|
17
17
|
attributed to the first plot.'
|
18
|
-
spec.homepage = 'https://github.com/
|
19
|
-
spec.required_ruby_version = Gem::Requirement.new('>=
|
18
|
+
spec.homepage = 'https://github.com/m4rcelotoledo/splittable'
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 3.4.6')
|
20
20
|
|
21
21
|
spec.metadata['homepage_uri'] = spec.homepage
|
22
|
-
spec.metadata['source_code_uri'] = 'https://github.com/
|
23
|
-
spec.metadata['changelog_uri'] = 'https://github.com/
|
22
|
+
spec.metadata['source_code_uri'] = 'https://github.com/m4rcelotoledo/splittable'
|
23
|
+
spec.metadata['changelog_uri'] = 'https://github.com/m4rcelotoledo/splittable/blob/master/CHANGELOG.md'
|
24
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
24
25
|
|
25
26
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
27
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splittable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arthur Brandão
|
8
8
|
- Marcelo Toledo
|
9
|
-
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: |-
|
15
14
|
This gem solves the problem of several decimal places in divisions
|
@@ -47,16 +46,15 @@ files:
|
|
47
46
|
- lib/splittable/division.rb
|
48
47
|
- lib/splittable/normalize.rb
|
49
48
|
- lib/splittable/version.rb
|
50
|
-
- sonar-project.properties
|
51
49
|
- splittable.gemspec
|
52
|
-
homepage: https://github.com/
|
50
|
+
homepage: https://github.com/m4rcelotoledo/splittable
|
53
51
|
licenses:
|
54
52
|
- MIT
|
55
53
|
metadata:
|
56
|
-
homepage_uri: https://github.com/
|
57
|
-
source_code_uri: https://github.com/
|
58
|
-
changelog_uri: https://github.com/
|
59
|
-
|
54
|
+
homepage_uri: https://github.com/m4rcelotoledo/splittable
|
55
|
+
source_code_uri: https://github.com/m4rcelotoledo/splittable
|
56
|
+
changelog_uri: https://github.com/m4rcelotoledo/splittable/blob/master/CHANGELOG.md
|
57
|
+
rubygems_mfa_required: 'true'
|
60
58
|
rdoc_options: []
|
61
59
|
require_paths:
|
62
60
|
- lib
|
@@ -64,15 +62,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
62
|
requirements:
|
65
63
|
- - ">="
|
66
64
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
65
|
+
version: 3.4.6
|
68
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
67
|
requirements:
|
70
68
|
- - ">="
|
71
69
|
- !ruby/object:Gem::Version
|
72
70
|
version: '0'
|
73
71
|
requirements: []
|
74
|
-
rubygems_version: 3.
|
75
|
-
signing_key:
|
72
|
+
rubygems_version: 3.6.9
|
76
73
|
specification_version: 4
|
77
74
|
summary: Calculate division and normalize parcels to use just cents.
|
78
75
|
test_files: []
|
data/sonar-project.properties
DELETED