hanami-utils 2.0.0.alpha3 → 2.0.0.alpha6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a34d2521940dfea9fb6d12a6cf65022aa340567e741801e3740d06e0e620d1f3
4
- data.tar.gz: d7396f0786283c15a398e41a1c3b62659be3d786b2df295733bca55253cb7def
3
+ metadata.gz: b31e4f747bffab786626dab7e503b8c1109e79bfbe1b4a7bed5e0bdda029e0cb
4
+ data.tar.gz: fef75e02594d51e4b681ba5101ea0c310af329806d1b18da2f1260abad934fd6
5
5
  SHA512:
6
- metadata.gz: 15f71cb5b8f88f6bb0ac02dce471120115923d8dff3676a5ed12860bc743d7d20ce9e6ad8ef5a29e233f63dbe5299510757c0f25b25d75c6818e8e72d9f7407c
7
- data.tar.gz: 85d58a5238393e7647a3b5dac295182619ae7f583c96d53c2928a8f79d3cee8cb0a5a7e306fc7e8705b884b76cb305e37e55afa3a9b9bb1122b049fb6776400a
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) 2.6+
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-2021 Luca Guidi – Released under MIT License
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.required_ruby_version = ">= 2.6.0"
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.91"
30
+ spec.add_development_dependency "rubocop", "~> 1.0"
30
31
  end
@@ -181,18 +181,10 @@ module Hanami
181
181
  # # ...
182
182
  # end
183
183
  # end
184
- if RUBY_VERSION >= "3.0"
185
- def initialize(*args, **kwargs)
186
- super
187
- ensure
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
- if RUBY_VERSION >= "3.0"
365
- def call(*args, **kwargs)
366
- @__result = ::Hanami::Interactor::Result.new
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
- if RUBY_VERSION >= "3.0"
381
- def _call(*args, **kwargs)
382
- catch :fail do
383
- validate!(*args, **kwargs)
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
- _prepare!
397
- end
371
+ _prepare!
398
372
  end
399
373
 
400
374
  # @since 1.1.0
401
- if RUBY_VERSION >= "3.0"
402
- def validate!(*args, **kwargs)
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
@@ -354,6 +354,8 @@ module Hanami
354
354
  # @since 1.2.0
355
355
  # @api private
356
356
  def tty?
357
+ return false if @logdev.nil?
358
+
357
359
  @logdev.dev.tty?
358
360
  end
359
361
  end
@@ -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
  #
@@ -11,7 +11,7 @@ module Hanami
11
11
  #
12
12
  # @since 0.8.0
13
13
  # @api private
14
- STRING_MATCHER = /\A[[:space:]]*\z/.freeze
14
+ STRING_MATCHER = /\A[[:space:]]*\z/
15
15
 
16
16
  # Checks if object is blank
17
17
  #
@@ -91,7 +91,7 @@ module Hanami
91
91
  #
92
92
  # @since 1.3.0
93
93
  # @api private
94
- TOKENIZE_REGEXP = /\((.*)\)/.freeze
94
+ TOKENIZE_REGEXP = /\((.*)\)/
95
95
 
96
96
  # Separator for .tokenize
97
97
  #
@@ -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
@@ -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}.freeze
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
- "#{(arg.respond_to?(:inspect) ? arg.inspect : arg.to_s)} "
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
@@ -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}/.freeze # rubocop:disable Layout/LineLength
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
 
@@ -5,6 +5,6 @@ module Hanami
5
5
  # Defines the version
6
6
  #
7
7
  # @since 0.1.0
8
- VERSION = "2.0.0.alpha3"
8
+ VERSION = "2.0.0.alpha6"
9
9
  end
10
10
  end
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.alpha3
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: 2021-11-09 00:00:00.000000000 Z
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.91'
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.91'
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: 2.6.0
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.2.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