dry-core 0.4.6 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +154 -41
- data/LICENSE +20 -0
- data/README.md +18 -36
- data/dry-core.gemspec +25 -23
- data/lib/dry-core.rb +3 -1
- data/lib/dry/core.rb +3 -1
- data/lib/dry/core/cache.rb +3 -1
- data/lib/dry/core/class_attributes.rb +32 -10
- data/lib/dry/core/class_builder.rb +3 -3
- data/lib/dry/core/constants.rb +52 -12
- data/lib/dry/core/deprecations.rb +12 -10
- data/lib/dry/core/descendants_tracker.rb +3 -1
- data/lib/dry/core/equalizer.rb +151 -0
- data/lib/dry/core/errors.rb +2 -0
- data/lib/dry/core/extensions.rb +3 -1
- data/lib/dry/core/inflector.rb +6 -3
- data/lib/dry/core/memoizable.rb +2 -0
- data/lib/dry/core/version.rb +3 -1
- metadata +25 -30
- data/.gitignore +0 -10
- data/.inch.yml +0 -4
- data/.rspec +0 -3
- data/.rubocop.yml +0 -31
- data/.travis.yml +0 -31
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -22
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 455db6bceb946acab5dbe431c4ba7edf9a7344f09c2b2af9e38c0b8788e3d600
|
4
|
+
data.tar.gz: c460402f0b99fbe8ad488463cebd828a6a814d0a45f5200fbf1c90302fa66649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c07482895edfb498acc414cc6672c2fa271cbd892f59393b4baa6b3b7ec4e115b29474be85fe42e40660fe06f926442608d693816594bdfcd910411185acad9c
|
7
|
+
data.tar.gz: c3d0966d660f09a26007e226b57e1cc2c124a420606b4de5d104730c6f5d9c54492a89788fb601722eab10f42dac4cda5d6689c79fe6c53a3df9c6510569fa7e
|
data/CHANGELOG.md
CHANGED
@@ -1,143 +1,256 @@
|
|
1
|
-
|
1
|
+
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
-
|
3
|
+
## unreleased
|
4
|
+
|
5
|
+
|
6
|
+
### Added
|
7
|
+
|
8
|
+
- dry-equalizer has been imported into dry-core as `Dry::Core::Equalizer` but the interface remains the same, which is `include Dry.Equalizer(...)` - we'll be porting all other gems that depend on dry-equalizer to the latest dry-core with equalizer included *gradually*. Eventually dry-equalizer usage will be gone completely in rom-rb/dry-rb/hanami projects (@solnic)
|
9
|
+
|
10
|
+
|
11
|
+
[Compare v0.4.10...master](https://github.com/dry-rb/dry-core/compare/v0.4.10...master)
|
12
|
+
|
13
|
+
## 0.4.10 2020-11-19
|
14
|
+
|
15
|
+
|
16
|
+
### Added
|
17
|
+
|
18
|
+
- `ClassAttributes.defines` gets a new option for coercing values (tallica)
|
19
|
+
```ruby
|
20
|
+
class Builder
|
21
|
+
extend Dry::Core::ClassAttributes
|
22
|
+
|
23
|
+
defines :nodes, coerce: -> value { Integer(value) }
|
24
|
+
end
|
25
|
+
```
|
26
|
+
`:coerce` works with any callable as well as types from dry-types
|
27
|
+
```ruby
|
28
|
+
defines :nodes, coerce: Dry::Types['coercible.integer']
|
29
|
+
```
|
30
|
+
- `Constants::IDENTITY` which is the identity function (flash-gordon)
|
31
|
+
|
32
|
+
|
33
|
+
[Compare v0.4.9...v0.4.10](https://github.com/dry-rb/dry-core/compare/v0.4.9...v0.4.10)
|
34
|
+
|
35
|
+
## 0.4.9 2019-08-09
|
36
|
+
|
37
|
+
|
38
|
+
### Added
|
39
|
+
|
40
|
+
- `Undefined.coalesce` takes a variable number of arguments and returns the first non-`Undefined` value (flash-gordon)
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
Undefined.coalesce(Undefined, Undefined, :foo) # => :foo
|
44
|
+
```
|
45
|
+
|
46
|
+
### Fixed
|
47
|
+
|
48
|
+
- `Undefined.{dup,clone}` returns `Undefined` back, `Undefined` is a singleton (flash-gordon)
|
49
|
+
|
50
|
+
|
51
|
+
[Compare v0.4.8...v0.4.9](https://github.com/dry-rb/dry-core/compare/v0.4.8...v0.4.9)
|
52
|
+
|
53
|
+
## 0.4.8 2019-06-23
|
54
|
+
|
55
|
+
|
56
|
+
### Added
|
57
|
+
|
58
|
+
- `Undefined.map` for mapping non-undefined values (flash-gordon)
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
something = 1
|
62
|
+
Undefined.map(something) { |v| v + 1 } # => 2
|
63
|
+
|
64
|
+
something = Undefined
|
65
|
+
Undefined.map(something) { |v| v + 1 } # => Undefined
|
66
|
+
```
|
67
|
+
|
68
|
+
|
69
|
+
[Compare v0.4.7...v0.4.8](https://github.com/dry-rb/dry-core/compare/v0.4.7...v0.4.8)
|
70
|
+
|
71
|
+
## 0.4.7 2018-06-25
|
72
|
+
|
73
|
+
|
74
|
+
### Fixed
|
75
|
+
|
76
|
+
- Fix default logger for deprecations, it now uses `$stderr` by default, as it should (flash-gordon)
|
77
|
+
|
78
|
+
|
79
|
+
[Compare v0.4.6...v0.4.7](https://github.com/dry-rb/dry-core/compare/v0.4.6...v0.4.7)
|
80
|
+
|
81
|
+
## 0.4.6 2018-05-15
|
82
|
+
|
83
|
+
|
84
|
+
### Changed
|
85
|
+
|
86
|
+
- Trigger constant autoloading in the class builder (radar)
|
4
87
|
|
5
88
|
[Compare v0.4.5...v0.4.6](https://github.com/dry-rb/dry-core/compare/v0.4.5...v0.4.6)
|
6
89
|
|
7
|
-
|
90
|
+
## 0.4.5 2018-03-14
|
91
|
+
|
8
92
|
|
9
93
|
### Added
|
10
94
|
|
11
|
-
|
95
|
+
- `Dry::Core::Memoizable`, which provides a `memoize` macro for memoizing results of instance methods (timriley)
|
96
|
+
|
12
97
|
|
13
98
|
[Compare v0.4.4...v0.4.5](https://github.com/dry-rb/dry-core/compare/v0.4.4...v0.4.5)
|
14
99
|
|
15
|
-
|
100
|
+
## 0.4.4 2018-02-10
|
101
|
+
|
16
102
|
|
17
103
|
### Added
|
18
104
|
|
19
|
-
|
20
|
-
|
105
|
+
- `deprecate_constant` overrides `Module#deprecate_constant` and issues a labeled message on accessing a deprecated constant (flash-gordon)
|
106
|
+
- `Undefined.default` which accepts two arguments and returns the first if it's not `Undefined`; otherwise, returns the second one or yields a block (flash-gordon)
|
107
|
+
|
21
108
|
|
22
109
|
[Compare v0.4.3...v0.4.4](https://github.com/dry-rb/dry-core/compare/v0.4.3...v0.4.4)
|
23
110
|
|
24
|
-
|
111
|
+
## 0.4.3 2018-02-03
|
112
|
+
|
25
113
|
|
26
114
|
### Added
|
27
115
|
|
28
|
-
|
116
|
+
- `Dry::Core::DescendantsTracker` which is a maintained version of the [`descendants_tracker`](https://github.com/dkubb/descendants_tracker) gem (flash-gordon)
|
29
117
|
|
30
|
-
[Compare v0.4.2...v0.4.3](https://github.com/dry-rb/dry-core/compare/v0.4.2...0.4.3)
|
31
118
|
|
32
|
-
|
119
|
+
[Compare v0.4.2...v0.4.3](https://github.com/dry-rb/dry-core/compare/v0.4.2...v0.4.3)
|
120
|
+
|
121
|
+
## 0.4.2 2017-12-16
|
122
|
+
|
33
123
|
|
34
124
|
### Fixed
|
35
125
|
|
36
|
-
|
126
|
+
- Class attributes now support private setters/getters (flash-gordon)
|
127
|
+
|
37
128
|
|
38
129
|
[Compare v0.4.1...v0.4.2](https://github.com/dry-rb/dry-core/compare/v0.4.1...v0.4.2)
|
39
130
|
|
40
|
-
|
131
|
+
## 0.4.1 2017-11-04
|
132
|
+
|
41
133
|
|
42
134
|
### Changed
|
43
135
|
|
44
|
-
|
136
|
+
- Improved error message on invalid attribute value (GustavoCaso)
|
45
137
|
|
46
138
|
[Compare v0.4.0...v0.4.1](https://github.com/dry-rb/dry-core/compare/v0.4.0...v0.4.1)
|
47
139
|
|
48
|
-
|
140
|
+
## 0.4.0 2017-11-02
|
141
|
+
|
49
142
|
|
50
143
|
### Added
|
51
144
|
|
52
|
-
|
145
|
+
- Added the `:type` option to class attributes, you can now restrict attribute values with a type. You can either use plain ruby types (`Integer`, `String`, etc) or `dry-types` (GustavoCaso)
|
53
146
|
|
54
147
|
```ruby
|
55
|
-
|
56
|
-
|
148
|
+
class Foo
|
149
|
+
extend Dry::Core::ClassAttributes
|
57
150
|
|
58
|
-
|
59
|
-
|
60
|
-
|
151
|
+
defines :ruby_attr, type: Integer
|
152
|
+
defines :dry_attr, type: Dry::Types['strict.int']
|
153
|
+
end
|
61
154
|
```
|
62
155
|
|
156
|
+
|
63
157
|
[Compare v0.3.4...v0.4.0](https://github.com/dry-rb/dry-core/compare/v0.3.4...v0.4.0)
|
64
158
|
|
65
|
-
|
159
|
+
## 0.3.4 2017-09-29
|
160
|
+
|
66
161
|
|
67
162
|
### Fixed
|
68
163
|
|
69
|
-
|
164
|
+
- `Deprecations` output is set to `$stderr` by default now (solnic)
|
165
|
+
|
70
166
|
|
71
167
|
[Compare v0.3.3...v0.3.4](https://github.com/dry-rb/dry-core/compare/v0.3.3...v0.3.4)
|
72
168
|
|
73
|
-
|
169
|
+
## 0.3.3 2017-08-31
|
170
|
+
|
74
171
|
|
75
172
|
### Fixed
|
76
173
|
|
77
|
-
|
174
|
+
- The Deprecations module now shows the right caller line (flash-gordon)
|
175
|
+
|
78
176
|
|
79
177
|
[Compare v0.3.2...v0.3.3](https://github.com/dry-rb/dry-core/compare/v0.3.2...v0.3.3)
|
80
178
|
|
81
|
-
|
179
|
+
## 0.3.2 2017-08-31
|
180
|
+
|
82
181
|
|
83
182
|
### Added
|
84
183
|
|
85
|
-
|
184
|
+
- Accept an existing logger object in `Dry::Core::Deprecations.set_logger!` (flash-gordon)
|
185
|
+
|
86
186
|
|
87
187
|
[Compare v0.3.1...v0.3.2](https://github.com/dry-rb/dry-core/compare/v0.3.1...v0.3.2)
|
88
188
|
|
89
|
-
|
189
|
+
## 0.3.1 2017-05-27
|
190
|
+
|
90
191
|
|
91
192
|
### Added
|
92
193
|
|
93
|
-
|
194
|
+
- Support for building classes within an existing namespace (flash-gordon)
|
195
|
+
|
94
196
|
|
95
197
|
[Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-core/compare/v0.3.0...v0.3.1)
|
96
198
|
|
97
|
-
|
199
|
+
## 0.3.0 2017-05-05
|
200
|
+
|
98
201
|
|
99
202
|
### Changed
|
100
203
|
|
101
|
-
|
204
|
+
- Class attributes are initialized _before_ running the `inherited` hook. It's slightly more convenient behavior and it's very unlikely anyone will be affected by this, but technically this is a breaking change (flash-gordon)
|
102
205
|
|
103
206
|
[Compare v0.2.4...v0.3.0](https://github.com/dry-rb/dry-core/compare/v0.2.4...v0.3.0)
|
104
207
|
|
105
|
-
|
208
|
+
## 0.2.4 2017-01-26
|
209
|
+
|
106
210
|
|
107
211
|
### Fixed
|
108
212
|
|
109
|
-
|
213
|
+
- Do not require deprecated method to be defined (flash-gordon)
|
214
|
+
|
110
215
|
|
111
216
|
[Compare v0.2.3...v0.2.4](https://github.com/dry-rb/dry-core/compare/v0.2.3...v0.2.4)
|
112
217
|
|
113
|
-
|
218
|
+
## 0.2.3 2016-12-30
|
219
|
+
|
114
220
|
|
115
221
|
### Fixed
|
116
222
|
|
117
|
-
|
223
|
+
- Fix warnings on using uninitialized class attributes (flash-gordon)
|
224
|
+
|
118
225
|
|
119
226
|
[Compare v0.2.2...v0.2.3](https://github.com/dry-rb/dry-core/compare/v0.2.2...v0.2.3)
|
120
227
|
|
121
|
-
|
228
|
+
## 0.2.2 2016-12-30
|
229
|
+
|
122
230
|
|
123
231
|
### Added
|
124
232
|
|
125
|
-
|
233
|
+
- `ClassAttributes` which provides `defines` method for defining get-or-set methods (flash-gordon)
|
234
|
+
|
126
235
|
|
127
236
|
[Compare v0.2.1...v0.2.2](https://github.com/dry-rb/dry-core/compare/v0.2.1...v0.2.2)
|
128
237
|
|
129
|
-
|
238
|
+
## 0.2.1 2016-11-18
|
239
|
+
|
130
240
|
|
131
241
|
### Added
|
132
242
|
|
133
|
-
|
243
|
+
- `Constants` are now available in nested scopes (flash-gordon)
|
244
|
+
|
134
245
|
|
135
246
|
[Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-core/compare/v0.2.0...v0.2.1)
|
136
247
|
|
137
|
-
|
248
|
+
## 0.2.0 2016-11-01
|
249
|
+
|
250
|
+
|
138
251
|
|
139
252
|
[Compare v0.1.0...v0.2.0](https://github.com/dry-rb/dry-core/compare/v0.1.0...v0.2.0)
|
140
253
|
|
141
|
-
|
254
|
+
## 0.1.0 2016-09-17
|
142
255
|
|
143
256
|
Initial release
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015-2020 dry-rb team
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,47 +1,29 @@
|
|
1
|
-
[gitter]: https://gitter.im/dry-rb/chat
|
2
1
|
[gem]: https://rubygems.org/gems/dry-core
|
3
|
-
[
|
4
|
-
[
|
5
|
-
[
|
2
|
+
[actions]: https://github.com/dry-rb/dry-core/actions
|
3
|
+
[codacy]: https://www.codacy.com/gh/dry-rb/dry-core
|
4
|
+
[chat]: https://dry-rb.zulipchat.com
|
5
|
+
[inchpages]: http://inch-ci.org/github/dry-rb/dry-core
|
6
6
|
|
7
|
-
# dry-core
|
7
|
+
# dry-core [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
|
8
8
|
|
9
|
-
[![Gem Version](https://
|
10
|
-
[![
|
11
|
-
[![
|
12
|
-
[![
|
13
|
-
[![
|
14
|
-
![No monkey-patches](https://img.shields.io/badge/monkey--patches-0-brightgreen.svg)
|
9
|
+
[![Gem Version](https://badge.fury.io/rb/dry-core.svg)][gem]
|
10
|
+
[![CI Status](https://github.com/dry-rb/dry-core/workflows/ci/badge.svg)][actions]
|
11
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/40946292b9094624beec604a149a6023)][codacy]
|
12
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/40946292b9094624beec604a149a6023)][codacy]
|
13
|
+
[![Inline docs](http://inch-ci.org/github/dry-rb/dry-core.svg?branch=master)][inchpages]
|
15
14
|
|
16
|
-
|
15
|
+
## Links
|
17
16
|
|
18
|
-
|
17
|
+
* [User documentation](http://dry-rb.org/gems/dry-core)
|
18
|
+
* [API documentation](http://rubydoc.info/gems/dry-core)
|
19
19
|
|
20
|
-
|
20
|
+
## Supported Ruby versions
|
21
21
|
|
22
|
-
|
23
|
-
gem 'dry-core'
|
24
|
-
```
|
25
|
-
|
26
|
-
And then execute:
|
27
|
-
|
28
|
-
$ bundle
|
29
|
-
|
30
|
-
Or install it yourself as:
|
31
|
-
|
32
|
-
$ gem install dry-core
|
33
|
-
|
34
|
-
## Development
|
35
|
-
|
36
|
-
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.
|
37
|
-
|
38
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, 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).
|
39
|
-
|
40
|
-
## Contributing
|
41
|
-
|
42
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/dry-rb/dry-core.
|
22
|
+
This library officially supports the following Ruby versions:
|
43
23
|
|
24
|
+
* MRI >= `2.5`
|
25
|
+
* jruby >= `9.2`
|
44
26
|
|
45
27
|
## License
|
46
28
|
|
47
|
-
|
29
|
+
See `LICENSE` file.
|
data/dry-core.gemspec
CHANGED
@@ -1,34 +1,36 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# this file is managed by dry-rb/devtools project
|
3
|
+
|
4
|
+
lib = File.expand_path('lib', __dir__)
|
2
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
6
|
require 'dry/core/version'
|
4
7
|
|
5
8
|
Gem::Specification.new do |spec|
|
6
9
|
spec.name = 'dry-core'
|
7
|
-
spec.
|
8
|
-
spec.
|
9
|
-
spec.
|
10
|
+
spec.authors = ["Nikita Shilnikov"]
|
11
|
+
spec.email = ["fg@flashgordon.ru"]
|
12
|
+
spec.license = 'MIT'
|
13
|
+
spec.version = Dry::Core::VERSION.dup
|
10
14
|
|
11
|
-
spec.summary =
|
15
|
+
spec.summary = "A toolset of small support modules used throughout the dry-rb ecosystem"
|
12
16
|
spec.description = spec.summary
|
13
|
-
spec.homepage = 'https://
|
14
|
-
spec.
|
17
|
+
spec.homepage = 'https://dry-rb.org/gems/dry-core'
|
18
|
+
spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-core.gemspec", "lib/**/*"]
|
19
|
+
spec.bindir = 'bin'
|
20
|
+
spec.executables = []
|
21
|
+
spec.require_paths = ['lib']
|
15
22
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
else
|
21
|
-
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
22
|
-
end
|
23
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
24
|
+
spec.metadata['changelog_uri'] = 'https://github.com/dry-rb/dry-core/blob/master/CHANGELOG.md'
|
25
|
+
spec.metadata['source_code_uri'] = 'https://github.com/dry-rb/dry-core'
|
26
|
+
spec.metadata['bug_tracker_uri'] = 'https://github.com/dry-rb/dry-core/issues'
|
23
27
|
|
24
|
-
spec.
|
25
|
-
|
26
|
-
|
27
|
-
spec.
|
28
|
-
spec.required_ruby_version = '>= 2.1.0'
|
29
|
-
spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
|
28
|
+
spec.required_ruby_version = ">= 2.5.0"
|
29
|
+
|
30
|
+
# to update dependencies edit project.yml
|
31
|
+
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
|
30
32
|
|
31
|
-
spec.add_development_dependency
|
32
|
-
spec.add_development_dependency
|
33
|
-
spec.add_development_dependency
|
33
|
+
spec.add_development_dependency "bundler"
|
34
|
+
spec.add_development_dependency "rake"
|
35
|
+
spec.add_development_dependency "rspec"
|
34
36
|
end
|