hanami-utils 2.0.0.alpha3 → 2.0.0.alpha6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +2 -4
- data/hanami-utils.gemspec +3 -2
- data/lib/hanami/interactor.rb +14 -46
- data/lib/hanami/logger.rb +2 -0
- data/lib/hanami/utils/basic_object.rb +0 -3
- data/lib/hanami/utils/blank.rb +1 -1
- data/lib/hanami/utils/class.rb +1 -1
- data/lib/hanami/utils/class_attribute.rb +7 -7
- data/lib/hanami/utils/kernel.rb +3 -3
- data/lib/hanami/utils/string.rb +1 -1
- data/lib/hanami/utils/version.rb +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b31e4f747bffab786626dab7e503b8c1109e79bfbe1b4a7bed5e0bdda029e0cb
|
4
|
+
data.tar.gz: fef75e02594d51e4b681ba5101ea0c310af329806d1b18da2f1260abad934fd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c62234ebc6ba706c83601b939d30eeb840eb34f11b9ff4bb9bc765acbe6c8182973a63ea088add5ad8ff26510b51f1293fcb2b54442d1b11ebbe7ff9dbc586ad
|
7
|
+
data.tar.gz: b52814d32d41e12b5f4bfd59f1b7bb0185871434eb92df3fbbd5e8d43249edfaf6acc1b4f001a64266d37e47e4ef09882ec23eb1a9a2a4be86d9636a00fb892c
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
# Hanami::Utils
|
2
2
|
Ruby core extentions and class utilities for Hanami
|
3
3
|
|
4
|
+
## v2.0.0.alpha6 - 2022-02-10
|
5
|
+
### Added
|
6
|
+
- [Luca Guidi] Official support for Ruby: MRI 3.0 and 3.1
|
7
|
+
|
8
|
+
### Fixed
|
9
|
+
- [Rob Jacoby] Allow `Hanami::Logger#initialize` to accept `File::NULL` as `stream:` argument
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
- [Luca Guidi] Drop support for Ruby: MRI 2.6 and 2.7.
|
13
|
+
|
4
14
|
## v2.0.0.alpha3 - 2021-11-09
|
5
15
|
No changes.
|
6
16
|
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ Ruby core extensions and class utilities for [Hanami](http://hanamirb.org)
|
|
26
26
|
|
27
27
|
## Rubies
|
28
28
|
|
29
|
-
__Hanami::Utils__ supports Ruby (MRI)
|
29
|
+
__Hanami::Utils__ supports Ruby (MRI) 3.0+
|
30
30
|
|
31
31
|
## Installation
|
32
32
|
|
@@ -145,6 +145,4 @@ __Hanami::Utils__ uses [Semantic Versioning 2.0.0](http://semver.org)
|
|
145
145
|
|
146
146
|
## Copyright
|
147
147
|
|
148
|
-
Copyright © 2014-
|
149
|
-
|
150
|
-
This project was formerly known as Lotus (`lotus-utils`).
|
148
|
+
Copyright © 2014-2022 Hanami Team – Released under MIT License
|
data/hanami-utils.gemspec
CHANGED
@@ -18,7 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
|
-
spec.
|
21
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
22
|
+
spec.required_ruby_version = ">= 3.0"
|
22
23
|
|
23
24
|
spec.add_dependency "dry-transformer", "~> 0.1"
|
24
25
|
spec.add_dependency "concurrent-ruby", "~> 1.0"
|
@@ -26,5 +27,5 @@ Gem::Specification.new do |spec|
|
|
26
27
|
spec.add_development_dependency "bundler", ">= 1.6", "< 3"
|
27
28
|
spec.add_development_dependency "rake", "~> 13"
|
28
29
|
spec.add_development_dependency "rspec", "~> 3.9"
|
29
|
-
spec.add_development_dependency "rubocop", "0
|
30
|
+
spec.add_development_dependency "rubocop", "~> 1.0"
|
30
31
|
end
|
data/lib/hanami/interactor.rb
CHANGED
@@ -181,18 +181,10 @@ module Hanami
|
|
181
181
|
# # ...
|
182
182
|
# end
|
183
183
|
# end
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
@__result = ::Hanami::Interactor::Result.new
|
189
|
-
end
|
190
|
-
else
|
191
|
-
def initialize(*args)
|
192
|
-
super
|
193
|
-
ensure
|
194
|
-
@__result = ::Hanami::Interactor::Result.new
|
195
|
-
end
|
184
|
+
def initialize(*args, **kwargs)
|
185
|
+
super
|
186
|
+
ensure
|
187
|
+
@__result = ::Hanami::Interactor::Result.new
|
196
188
|
end
|
197
189
|
|
198
190
|
# Triggers the operation and return a result.
|
@@ -361,51 +353,27 @@ module Hanami
|
|
361
353
|
# end
|
362
354
|
#
|
363
355
|
# Signup.new.call # => NoMethodError
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
_call(*args, **kwargs) { super }
|
368
|
-
end
|
369
|
-
else
|
370
|
-
def call(*args)
|
371
|
-
@__result = ::Hanami::Interactor::Result.new
|
372
|
-
_call(*args) { super }
|
373
|
-
end
|
356
|
+
def call(*args, **kwargs)
|
357
|
+
@__result = ::Hanami::Interactor::Result.new
|
358
|
+
_call(*args, **kwargs) { super }
|
374
359
|
end
|
375
360
|
|
376
361
|
private
|
377
362
|
|
378
363
|
# @api private
|
379
364
|
# @since 1.1.0
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
yield
|
385
|
-
end
|
386
|
-
|
387
|
-
_prepare!
|
365
|
+
def _call(*args, **kwargs)
|
366
|
+
catch :fail do
|
367
|
+
validate!(*args, **kwargs)
|
368
|
+
yield
|
388
369
|
end
|
389
|
-
else
|
390
|
-
def _call(*args)
|
391
|
-
catch :fail do
|
392
|
-
validate!(*args)
|
393
|
-
yield
|
394
|
-
end
|
395
370
|
|
396
|
-
|
397
|
-
end
|
371
|
+
_prepare!
|
398
372
|
end
|
399
373
|
|
400
374
|
# @since 1.1.0
|
401
|
-
|
402
|
-
|
403
|
-
fail! unless valid?(*args, **kwargs)
|
404
|
-
end
|
405
|
-
else
|
406
|
-
def validate!(*args)
|
407
|
-
fail! unless valid?(*args)
|
408
|
-
end
|
375
|
+
def validate!(*args, **kwargs)
|
376
|
+
fail! unless valid?(*args, **kwargs)
|
409
377
|
end
|
410
378
|
end
|
411
379
|
|
data/lib/hanami/logger.rb
CHANGED
@@ -39,12 +39,9 @@ module Hanami
|
|
39
39
|
# @since 0.3.5
|
40
40
|
#
|
41
41
|
# @see http://ruby-doc.org/core/Object.html#method-i-inspect
|
42
|
-
#
|
43
|
-
# rubocop:disable Style/FormatStringToken
|
44
42
|
def inspect
|
45
43
|
"#<#{self.class}:#{'0x0000%x' % (__id__ << 1)}#{__inspect}>"
|
46
44
|
end
|
47
|
-
# rubocop:enable Style/FormatStringToken
|
48
45
|
|
49
46
|
# @!macro [attach] instance_of?(class)
|
50
47
|
#
|
data/lib/hanami/utils/blank.rb
CHANGED
data/lib/hanami/utils/class.rb
CHANGED
@@ -75,13 +75,13 @@ module Hanami
|
|
75
75
|
def class_attribute(*attributes)
|
76
76
|
attributes.each do |attr|
|
77
77
|
singleton_class.class_eval %(
|
78
|
-
def #{attr}
|
79
|
-
class_attributes[:#{attr}]
|
80
|
-
end
|
81
|
-
|
82
|
-
def #{attr}=(value)
|
83
|
-
class_attributes[:#{attr}] = value
|
84
|
-
end
|
78
|
+
def #{attr} # def foo
|
79
|
+
class_attributes[:#{attr}] # class_attributes[:foo]
|
80
|
+
end # end
|
81
|
+
#
|
82
|
+
def #{attr}=(value) # def foo=(value)
|
83
|
+
class_attributes[:#{attr}] = value # class_attributes[:foo] = value
|
84
|
+
end # end
|
85
85
|
), __FILE__, __LINE__ - 8
|
86
86
|
end
|
87
87
|
end
|
data/lib/hanami/utils/kernel.rb
CHANGED
@@ -28,7 +28,7 @@ module Hanami
|
|
28
28
|
# @api private
|
29
29
|
#
|
30
30
|
# @see Hanami::Utils::Kernel.Integer
|
31
|
-
NUMERIC_MATCHER = %r{\A([\d/.+iE]+|NaN|Infinity)\z}
|
31
|
+
NUMERIC_MATCHER = %r{\A([\d/.+iE]+|NaN|Infinity)\z}
|
32
32
|
|
33
33
|
# @since 0.8.0
|
34
34
|
# @api private
|
@@ -1015,7 +1015,7 @@ module Hanami
|
|
1015
1015
|
case arg
|
1016
1016
|
when "" then raise TypeError.new "can't convert #{inspect_type_error(arg)}into Symbol"
|
1017
1017
|
when ->(a) { a.respond_to?(:to_sym) } then arg.to_sym
|
1018
|
-
else
|
1018
|
+
else # rubocop:disable Lint/DuplicateBranch
|
1019
1019
|
raise TypeError.new "can't convert #{inspect_type_error(arg)}into Symbol"
|
1020
1020
|
end
|
1021
1021
|
rescue NoMethodError
|
@@ -1043,7 +1043,7 @@ module Hanami
|
|
1043
1043
|
# @since 0.4.3
|
1044
1044
|
# @api private
|
1045
1045
|
def self.inspect_type_error(arg)
|
1046
|
-
"#{
|
1046
|
+
"#{arg.respond_to?(:inspect) ? arg.inspect : arg.to_s} "
|
1047
1047
|
rescue NoMethodError
|
1048
1048
|
# missing the #respond_to? method, fall back to returning the class' name
|
1049
1049
|
begin
|
data/lib/hanami/utils/string.rb
CHANGED
@@ -61,7 +61,7 @@ module Hanami
|
|
61
61
|
#
|
62
62
|
# @since 0.3.4
|
63
63
|
# @api private
|
64
|
-
CLASSIFY_WORD_SEPARATOR = /#{CLASSIFY_SEPARATOR}|#{NAMESPACE_SEPARATOR}|#{UNDERSCORE_SEPARATOR}|#{DASHERIZE_SEPARATOR}
|
64
|
+
CLASSIFY_WORD_SEPARATOR = /#{CLASSIFY_SEPARATOR}|#{NAMESPACE_SEPARATOR}|#{UNDERSCORE_SEPARATOR}|#{DASHERIZE_SEPARATOR}/ # rubocop:disable Layout/LineLength
|
65
65
|
|
66
66
|
@__transformations__ = Concurrent::Map.new
|
67
67
|
|
data/lib/hanami/utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.alpha6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-transformer
|
@@ -90,16 +90,16 @@ dependencies:
|
|
90
90
|
name: rubocop
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0
|
95
|
+
version: '1.0'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '0
|
102
|
+
version: '1.0'
|
103
103
|
description: Hanami utilities
|
104
104
|
email:
|
105
105
|
- me@lucaguidi.com
|
@@ -142,7 +142,8 @@ files:
|
|
142
142
|
homepage: http://hanamirb.org
|
143
143
|
licenses:
|
144
144
|
- MIT
|
145
|
-
metadata:
|
145
|
+
metadata:
|
146
|
+
rubygems_mfa_required: 'true'
|
146
147
|
post_install_message:
|
147
148
|
rdoc_options: []
|
148
149
|
require_paths:
|
@@ -151,14 +152,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
152
|
requirements:
|
152
153
|
- - ">="
|
153
154
|
- !ruby/object:Gem::Version
|
154
|
-
version:
|
155
|
+
version: '3.0'
|
155
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
157
|
requirements:
|
157
158
|
- - ">"
|
158
159
|
- !ruby/object:Gem::Version
|
159
160
|
version: 1.3.1
|
160
161
|
requirements: []
|
161
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.3.3
|
162
163
|
signing_key:
|
163
164
|
specification_version: 4
|
164
165
|
summary: Ruby core extentions and Hanami utilities
|