lite-errors 1.0.1 → 1.1.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 +4 -4
- data/.rubocop.yml +15 -4
- data/.travis.yml +15 -10
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +42 -35
- data/README.md +10 -8
- data/lib/lite/errors/messages.rb +7 -0
- data/lib/lite/errors/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04a784794ba9aa6e1944bf5a96757f2807327482218dbe3f16396977c20371f4
|
|
4
|
+
data.tar.gz: 61b73313504f5cd116e3f64d555ee3d3dfd5c50b46b788bcce84f672b28e0974
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21a0a59af693705a89f5593991cef055d4e2ae98579ac2b1f7f670920283144d53e3ec0c97f451d7b9ac7b38f1e25f9c5bf532ffa6c5dd59713bc0b91ecc1714
|
|
7
|
+
data.tar.gz: 7e7b38eb14a27f56dcbde51fdf6106c1d1651ed30c0adae403d4cb1d7fd2ead878dcab83f582c318fc8a59a1f3c103c15b0ce1496ab23bafbfdaa35e2ef6d388
|
data/.rubocop.yml
CHANGED
|
@@ -2,18 +2,29 @@ require:
|
|
|
2
2
|
- rubocop-performance
|
|
3
3
|
- rubocop-rspec
|
|
4
4
|
AllCops:
|
|
5
|
-
TargetRubyVersion: 2.
|
|
5
|
+
TargetRubyVersion: 2.7
|
|
6
|
+
NewCops: enable
|
|
6
7
|
DisplayCopNames: true
|
|
7
8
|
DisplayStyleGuide: true
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
Gemspec/RequiredRubyVersion:
|
|
10
|
+
Enabled: false
|
|
11
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
|
12
|
+
Enabled: true
|
|
10
13
|
Layout/EmptyLinesAroundBlockBody:
|
|
11
14
|
Exclude:
|
|
12
15
|
- 'spec/**/**/*'
|
|
13
16
|
Layout/EmptyLinesAroundClassBody:
|
|
14
|
-
EnforcedStyle:
|
|
17
|
+
EnforcedStyle: empty_lines_except_namespace
|
|
15
18
|
Layout/EmptyLinesAroundModuleBody:
|
|
16
19
|
EnforcedStyle: empty_lines_except_namespace
|
|
20
|
+
Layout/LineLength:
|
|
21
|
+
Max: 100
|
|
22
|
+
Layout/SpaceAroundMethodCallOperator:
|
|
23
|
+
Enabled: true
|
|
24
|
+
Lint/RaiseException:
|
|
25
|
+
Enabled: true
|
|
26
|
+
Lint/StructNewOverride:
|
|
27
|
+
Enabled: true
|
|
17
28
|
Metrics/BlockLength:
|
|
18
29
|
Exclude:
|
|
19
30
|
- 'spec/**/**/*'
|
data/.travis.yml
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
---
|
|
2
1
|
sudo: false
|
|
3
2
|
language: ruby
|
|
4
3
|
cache: bundler
|
|
5
4
|
rvm:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
- 2.5
|
|
6
|
+
- 2.6
|
|
7
|
+
- 2.7
|
|
8
|
+
- ruby-head
|
|
9
9
|
matrix:
|
|
10
10
|
fast_finish: true
|
|
11
11
|
allow_failures:
|
|
12
|
-
|
|
12
|
+
- rvm: ruby-head
|
|
13
13
|
before_install:
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
- gem update --system
|
|
15
|
+
- gem install bundler
|
|
16
16
|
install:
|
|
17
|
-
|
|
17
|
+
- bundle install --jobs=3 --retry=3
|
|
18
18
|
script:
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
- bundle exec rspec
|
|
20
|
+
- bundle exec rubocop
|
|
21
|
+
# - bundle exec fasterer
|
|
22
|
+
notifications:
|
|
23
|
+
email: false
|
|
24
|
+
slack:
|
|
25
|
+
secure: CYSB+0IcRuv8gars8cBZHz046TCYUpijTZj/Z1FsaF7JRe0QP3XlcaPC9bowc0utXitMRuW1E1h9VbmtmN5NP2gNNj93xfIMUorhEUUiyfruYqQb/lq9IxLC113WppFXT31MXgmk7cpsEx8uxagPURFZpaicURK/MiW1af3D2o3snvJqxAVe8XQGJt3IUj2xteYqPJO1G1Zbk5MFK0J53BIPWB8Mm2wV9NwNcRkJ6szuiIB35tLrcGjfQljayfOWUq+Bj2IuChDfMlcH8no+79m/+7XL7/Kao6S/zmaIA26uURyZdDkyeHr8fX6hlraOv8XKf6FZ8XqSSfJ/8vC2DX/ooausdvJ3cNAf9iaxURyqNeisiQ6IsQtr+70KvXW8Ko5V1Y8fh/nIy9L7swgIkh9n7Gb9lWNL15DNxPU0Ooaqm85qGpoHH7wVmf5565YXdClSwXqk/js/6ZmKri//35PlrxiGAm7sDuIqbwz4aIY+tVfQeT/dcuHZ6lAb2/eMd3WGxj+TqSQHok+1cla8l8T+xuMS6Mw81aur8bwUT+aiWMnbQrR0BnItG8bUEG2Ha8LukluBbT7Jdlv5fE0jWeg9TgqZ09uKGsarc2FkeWHSqF1627HCsPLWEQEYx7unMK5bmOtgl9lJE1MmpZ0wWHjg4IOhWsbhqvYz1iUNWc0=
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.1.0] - 2021-06-03
|
|
10
|
+
### Added
|
|
11
|
+
- Added methods for Rails 6.1 changes
|
|
12
|
+
|
|
13
|
+
## [1.0.1] - 2019-06-24
|
|
14
|
+
### Added
|
|
15
|
+
- Added ruby 2.7 support
|
|
16
|
+
### Changed
|
|
17
|
+
- Changed `slice!` method to accept multiple args
|
|
18
|
+
|
|
9
19
|
## [1.0.0] - 2019-06-24
|
|
10
20
|
### Added
|
|
11
21
|
- Initial project version
|
data/Gemfile.lock
CHANGED
|
@@ -1,52 +1,59 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
lite-errors (1.0
|
|
4
|
+
lite-errors (1.1.0)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
ast (2.4.
|
|
9
|
+
ast (2.4.2)
|
|
10
10
|
colorize (0.8.1)
|
|
11
|
-
diff-lcs (1.
|
|
12
|
-
fasterer (0.
|
|
11
|
+
diff-lcs (1.4.4)
|
|
12
|
+
fasterer (0.9.0)
|
|
13
13
|
colorize (~> 0.7)
|
|
14
|
-
ruby_parser (>= 3.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
ast (~> 2.4.0)
|
|
14
|
+
ruby_parser (>= 3.14.1)
|
|
15
|
+
parallel (1.20.1)
|
|
16
|
+
parser (3.0.1.1)
|
|
17
|
+
ast (~> 2.4.1)
|
|
19
18
|
rainbow (3.0.0)
|
|
20
|
-
rake (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
rspec-
|
|
25
|
-
|
|
26
|
-
rspec-
|
|
27
|
-
rspec-
|
|
19
|
+
rake (13.0.3)
|
|
20
|
+
regexp_parser (2.1.1)
|
|
21
|
+
rexml (3.2.5)
|
|
22
|
+
rspec (3.10.0)
|
|
23
|
+
rspec-core (~> 3.10.0)
|
|
24
|
+
rspec-expectations (~> 3.10.0)
|
|
25
|
+
rspec-mocks (~> 3.10.0)
|
|
26
|
+
rspec-core (3.10.1)
|
|
27
|
+
rspec-support (~> 3.10.0)
|
|
28
|
+
rspec-expectations (3.10.1)
|
|
28
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
|
-
rspec-support (~> 3.
|
|
30
|
-
rspec-mocks (3.
|
|
30
|
+
rspec-support (~> 3.10.0)
|
|
31
|
+
rspec-mocks (3.10.2)
|
|
31
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
-
rspec-support (~> 3.
|
|
33
|
-
rspec-support (3.
|
|
34
|
-
rubocop (
|
|
35
|
-
jaro_winkler (~> 1.5.1)
|
|
33
|
+
rspec-support (~> 3.10.0)
|
|
34
|
+
rspec-support (3.10.2)
|
|
35
|
+
rubocop (1.16.0)
|
|
36
36
|
parallel (~> 1.10)
|
|
37
|
-
parser (>=
|
|
37
|
+
parser (>= 3.0.0.0)
|
|
38
38
|
rainbow (>= 2.2.2, < 4.0)
|
|
39
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
40
|
+
rexml
|
|
41
|
+
rubocop-ast (>= 1.7.0, < 2.0)
|
|
39
42
|
ruby-progressbar (~> 1.7)
|
|
40
|
-
unicode-display_width (>= 1.4.0, <
|
|
41
|
-
rubocop-
|
|
42
|
-
|
|
43
|
-
rubocop-
|
|
44
|
-
rubocop (>=
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
44
|
+
rubocop-ast (1.7.0)
|
|
45
|
+
parser (>= 3.0.1.1)
|
|
46
|
+
rubocop-performance (1.11.3)
|
|
47
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
48
|
+
rubocop-ast (>= 0.4.0)
|
|
49
|
+
rubocop-rspec (2.3.0)
|
|
50
|
+
rubocop (~> 1.0)
|
|
51
|
+
rubocop-ast (>= 1.1.0)
|
|
52
|
+
ruby-progressbar (1.11.0)
|
|
53
|
+
ruby_parser (3.16.0)
|
|
54
|
+
sexp_processor (~> 4.15, >= 4.15.1)
|
|
55
|
+
sexp_processor (4.15.3)
|
|
56
|
+
unicode-display_width (2.0.0)
|
|
50
57
|
|
|
51
58
|
PLATFORMS
|
|
52
59
|
ruby
|
|
@@ -62,4 +69,4 @@ DEPENDENCIES
|
|
|
62
69
|
rubocop-rspec
|
|
63
70
|
|
|
64
71
|
BUNDLED WITH
|
|
65
|
-
2.
|
|
72
|
+
2.2.19
|
data/README.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
[](https://travis-ci.org/drexed/lite-errors)
|
|
5
5
|
|
|
6
6
|
Lite::Errors provides an API for generating and accessing error messages.
|
|
7
|
-
|
|
7
|
+
The API is ~90% compatible with `ActiveModel::Errors` and there are few
|
|
8
|
+
extra handy methods for interacting with errors so we encourage you to
|
|
9
|
+
look through the lib files.
|
|
8
10
|
|
|
9
11
|
**NOTE:** If you are coming from `ActiveErrors`, please read the [port](#port) section.
|
|
10
12
|
|
|
@@ -26,14 +28,8 @@ Or install it yourself as:
|
|
|
26
28
|
|
|
27
29
|
## Table of Contents
|
|
28
30
|
|
|
29
|
-
* [Port](#port)
|
|
30
31
|
* [Usage](#usage)
|
|
31
|
-
|
|
32
|
-
## Port
|
|
33
|
-
|
|
34
|
-
`Lite::Errors` is compatible port of [ActiveErrors](https://github.com/drexed/active_errors).
|
|
35
|
-
|
|
36
|
-
Switching is as easy as renaming `ActiveError::Messages` to `Lite::Errors::Messages`.
|
|
32
|
+
* [Port](#port)
|
|
37
33
|
|
|
38
34
|
## Usage
|
|
39
35
|
|
|
@@ -63,6 +59,12 @@ class Shipment
|
|
|
63
59
|
end
|
|
64
60
|
```
|
|
65
61
|
|
|
62
|
+
## Port
|
|
63
|
+
|
|
64
|
+
`Lite::Errors` is a compatible port of [ActiveErrors](https://github.com/drexed/active_errors).
|
|
65
|
+
|
|
66
|
+
Switching is as easy as renaming `ActiveError::Messages` to `Lite::Errors::Messages`.
|
|
67
|
+
|
|
66
68
|
## Development
|
|
67
69
|
|
|
68
70
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/lite/errors/messages.rb
CHANGED
|
@@ -16,6 +16,8 @@ module Lite
|
|
|
16
16
|
@errors[key]
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
alias messages_for []
|
|
20
|
+
|
|
19
21
|
def []=(key, value)
|
|
20
22
|
@errors[key] ||= []
|
|
21
23
|
@errors[key] << value
|
|
@@ -83,6 +85,8 @@ module Lite
|
|
|
83
85
|
@errors.keys
|
|
84
86
|
end
|
|
85
87
|
|
|
88
|
+
alias attribute_names keys
|
|
89
|
+
|
|
86
90
|
def merge!(hash)
|
|
87
91
|
@errors.merge!(hash) do |_, arr1, arr2|
|
|
88
92
|
arr3 = arr1 + arr2
|
|
@@ -106,6 +110,7 @@ module Lite
|
|
|
106
110
|
@errors
|
|
107
111
|
end
|
|
108
112
|
|
|
113
|
+
# rubocop:disable Style/OptionalBooleanParameter
|
|
109
114
|
def to_hash(full_messages = false)
|
|
110
115
|
return @errors unless full_messages
|
|
111
116
|
|
|
@@ -113,8 +118,10 @@ module Lite
|
|
|
113
118
|
memo[key] = arr.map { |val| full_message(key, val) }
|
|
114
119
|
end
|
|
115
120
|
end
|
|
121
|
+
# rubocop:enable Style/OptionalBooleanParameter
|
|
116
122
|
|
|
117
123
|
alias messages to_hash
|
|
124
|
+
alias group_by_attribute to_hash
|
|
118
125
|
alias as_json to_hash
|
|
119
126
|
|
|
120
127
|
def values
|
data/lib/lite/errors/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lite-errors
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juan Gomez
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-06-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -108,7 +108,7 @@ dependencies:
|
|
|
108
108
|
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
|
-
description:
|
|
111
|
+
description:
|
|
112
112
|
email:
|
|
113
113
|
- j.gomez@drexed.com
|
|
114
114
|
executables: []
|
|
@@ -138,7 +138,7 @@ homepage: http://drexed.github.io/lite-errors
|
|
|
138
138
|
licenses:
|
|
139
139
|
- MIT
|
|
140
140
|
metadata: {}
|
|
141
|
-
post_install_message:
|
|
141
|
+
post_install_message:
|
|
142
142
|
rdoc_options: []
|
|
143
143
|
require_paths:
|
|
144
144
|
- lib
|
|
@@ -153,8 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
153
153
|
- !ruby/object:Gem::Version
|
|
154
154
|
version: '0'
|
|
155
155
|
requirements: []
|
|
156
|
-
rubygems_version: 3.
|
|
157
|
-
signing_key:
|
|
156
|
+
rubygems_version: 3.2.19
|
|
157
|
+
signing_key:
|
|
158
158
|
specification_version: 4
|
|
159
159
|
summary: Build ActiveModel::Errors like errors in Ruby
|
|
160
160
|
test_files: []
|