hanami-utils 1.2.0 → 1.3.0.beta1
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/CHANGELOG.md +15 -0
- data/README.md +5 -5
- data/hanami-utils.gemspec +1 -1
- data/lib/hanami-utils.rb +1 -1
- data/lib/hanami/utils/class.rb +33 -2
- data/lib/hanami/utils/files.rb +76 -10
- data/lib/hanami/utils/hash.rb +14 -0
- data/lib/hanami/utils/inflector.rb +2 -0
- data/lib/hanami/utils/kernel.rb +1 -1
- data/lib/hanami/utils/string.rb +26 -3
- data/lib/hanami/utils/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: 54d09fd1479ee07fdc4123bcf919f59929d6bd0c09224674c0432443d438c4f6
|
4
|
+
data.tar.gz: b46600bfa6191095e325867907830c4c1bfac0fcf4e9fb24f6f2907b1d15236c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3608dfc31ba508caa081b50c931e1ddcf00eca260f521fcd91dab9ebe7b7e827c56301b33280551657284231654032025d5ab9de07403bc1db56ee12352f856
|
7
|
+
data.tar.gz: '09f78de10703da264abbc636f8a4bf9172c5565dce7882533c21adca31bf158841bf80998821f158ca77604b9fc9670a677f02644949fd1714a16766fda28918'
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
# Hanami::Utils
|
2
2
|
Ruby core extentions and class utilities for Hanami
|
3
3
|
|
4
|
+
## v1.3.0.beta1 - 2018-08-08
|
5
|
+
### Added
|
6
|
+
- [Luca Guidi] Official support for JRuby 9.2.0.0
|
7
|
+
- [graywolf] Add `Utils::Files.inject_line_before_last` and `.inject_line_after_last`
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
- [graywolf] Don't show `Fixnum` Ruby warning for 2.4+
|
11
|
+
- [Luca Guidi] Fix pluralization of `"fee"`
|
12
|
+
|
13
|
+
### Deprecated
|
14
|
+
- [Luca Guidi & Marion Schleifer] Deprecate `Utils::String` as Ruby type. Please use `Utils::String` class methods instead of `Utils::String.new("")`.
|
15
|
+
- [Luca Guidi & Marion Schleifer] Deprecate `Utils::Hash` as Ruby type. Please use `Utils::Hash` class methods instead of `Utils::Hash.new({})`.
|
16
|
+
- [Luca Guidi & Marion Schleifer] Deprecate `Utils::String.pluralize` and `.singularize`.
|
17
|
+
- [Semyon Pupkov] Deprecate `Utils::Class.load_from_pattern!`
|
18
|
+
|
4
19
|
## v1.2.0 - 2018-04-11
|
5
20
|
|
6
21
|
## v1.2.0.rc2 - 2018-04-06
|
data/README.md
CHANGED
@@ -4,11 +4,11 @@ Ruby core extensions and class utilities for [Hanami](http://hanamirb.org)
|
|
4
4
|
|
5
5
|
## Status
|
6
6
|
|
7
|
-
[](https://badge.fury.io/rb/hanami-utils)
|
8
|
+
[](https://travis-ci.org/hanami/utils)
|
9
|
+
[](https://circleci.com/gh/hanami/utils/tree/master)
|
10
|
+
[](https://codecov.io/gh/hanami/utils)
|
11
|
+
[](https://depfu.com/github/hanami/utils?project=Bundler)
|
12
12
|
[](http://inch-ci.org/github/hanami/utils)
|
13
13
|
|
14
14
|
## Contact
|
data/hanami-utils.gemspec
CHANGED
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency 'concurrent-ruby', '~> 1.0'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
25
|
-
spec.add_development_dependency 'rake', '~>
|
25
|
+
spec.add_development_dependency 'rake', '~> 12'
|
26
26
|
spec.add_development_dependency 'rspec', '~> 3.7'
|
27
27
|
end
|
data/lib/hanami-utils.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'hanami/utils'
|
1
|
+
require 'hanami/utils'
|
data/lib/hanami/utils/class.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'hanami/utils/
|
1
|
+
require 'hanami/utils/deprecation'
|
2
2
|
|
3
3
|
module Hanami
|
4
4
|
module Utils
|
@@ -110,7 +110,9 @@ module Hanami
|
|
110
110
|
# # with missing constant
|
111
111
|
# Hanami::Utils::Class.load_from_pattern!('Unknown') # => raises NameError
|
112
112
|
def self.load_from_pattern!(pattern, namespace = Object)
|
113
|
-
|
113
|
+
Deprecation.new('Hanami::Utils::Class.load_from_pattern! is deprecated, please use Hanami::Utils::Class.load! instead')
|
114
|
+
|
115
|
+
tokenize(pattern) do |token|
|
114
116
|
begin
|
115
117
|
return namespace.const_get(token, false)
|
116
118
|
rescue NameError # rubocop:disable Lint/HandleExceptions
|
@@ -120,6 +122,35 @@ module Hanami
|
|
120
122
|
full_name = [(namespace == Object ? nil : namespace), pattern].compact.join('::')
|
121
123
|
raise NameError.new("uninitialized constant #{full_name}")
|
122
124
|
end
|
125
|
+
|
126
|
+
# rubocop:disable Metrics/MethodLength
|
127
|
+
def self.tokenize(pattern)
|
128
|
+
if match = TOKENIZE_REGEXP.match(pattern) # rubocop:disable Lint/AssignmentInCondition
|
129
|
+
pre = match.pre_match
|
130
|
+
post = match.post_match
|
131
|
+
tokens = match[1].split(TOKENIZE_SEPARATOR)
|
132
|
+
tokens.each do |token|
|
133
|
+
yield("#{pre}#{token}#{post}")
|
134
|
+
end
|
135
|
+
else
|
136
|
+
yield(pattern)
|
137
|
+
end
|
138
|
+
|
139
|
+
nil
|
140
|
+
end
|
141
|
+
# rubocop:enable Metrics/MethodLength
|
142
|
+
|
143
|
+
# Regexp for .tokenize
|
144
|
+
#
|
145
|
+
# @since 1.3.0
|
146
|
+
# @api private
|
147
|
+
TOKENIZE_REGEXP = /\((.*)\)/
|
148
|
+
|
149
|
+
# Separator for .tokenize
|
150
|
+
#
|
151
|
+
# @since 1.3.0
|
152
|
+
# @api private
|
153
|
+
TOKENIZE_SEPARATOR = '|'.freeze
|
123
154
|
end
|
124
155
|
end
|
125
156
|
end
|
data/lib/hanami/utils/files.rb
CHANGED
@@ -215,14 +215,30 @@ module Hanami
|
|
215
215
|
# @raise [ArgumentError] if `target` cannot be found in `path`
|
216
216
|
#
|
217
217
|
# @see .inject_line_after
|
218
|
+
# @see .inject_line_before_last
|
219
|
+
# @see .inject_line_after_last
|
218
220
|
#
|
219
221
|
# @since 1.1.0
|
220
222
|
def self.inject_line_before(path, target, contents)
|
221
|
-
|
222
|
-
|
223
|
+
_inject_line_before(path, target, contents, method(:index))
|
224
|
+
end
|
223
225
|
|
224
|
-
|
225
|
-
|
226
|
+
# Inject `contents` in `path` after last `target`.
|
227
|
+
#
|
228
|
+
# @param path [String,Pathname] the path to file
|
229
|
+
# @param target [String,Regexp] the target to replace
|
230
|
+
# @param contents [String] the contents to inject
|
231
|
+
#
|
232
|
+
# @raise [Errno::ENOENT] if the path doesn't exist
|
233
|
+
# @raise [ArgumentError] if `target` cannot be found in `path`
|
234
|
+
#
|
235
|
+
# @see .inject_line_before
|
236
|
+
# @see .inject_line_after
|
237
|
+
# @see .inject_line_after_last
|
238
|
+
#
|
239
|
+
# @since 1.3.0
|
240
|
+
def self.inject_line_before_last(path, target, contents)
|
241
|
+
_inject_line_before(path, target, contents, method(:rindex))
|
226
242
|
end
|
227
243
|
|
228
244
|
# Inject `contents` in `path` after `target`.
|
@@ -235,14 +251,31 @@ module Hanami
|
|
235
251
|
# @raise [ArgumentError] if `target` cannot be found in `path`
|
236
252
|
#
|
237
253
|
# @see .inject_line_before
|
254
|
+
# @see .inject_line_before_last
|
255
|
+
# @see .inject_line_after_last
|
238
256
|
#
|
239
257
|
# @since 1.1.0
|
240
258
|
def self.inject_line_after(path, target, contents)
|
241
|
-
|
242
|
-
|
259
|
+
_inject_line_after(path, target, contents, method(:index))
|
260
|
+
end
|
243
261
|
|
244
|
-
|
245
|
-
|
262
|
+
# Inject `contents` in `path` after last `target`.
|
263
|
+
#
|
264
|
+
# @param path [String,Pathname] the path to file
|
265
|
+
# @param target [String,Regexp] the target to replace
|
266
|
+
# @param contents [String] the contents to inject
|
267
|
+
#
|
268
|
+
# @raise [Errno::ENOENT] if the path doesn't exist
|
269
|
+
# @raise [ArgumentError] if `target` cannot be found in `path`
|
270
|
+
#
|
271
|
+
# @see .inject_line_before
|
272
|
+
# @see .inject_line_after
|
273
|
+
# @see .inject_line_before_last
|
274
|
+
# @see .inject_line_after_last
|
275
|
+
#
|
276
|
+
# @since 1.3.0
|
277
|
+
def self.inject_line_after_last(path, target, contents)
|
278
|
+
_inject_line_after(path, target, contents, method(:rindex))
|
246
279
|
end
|
247
280
|
|
248
281
|
# Removes line from `path`, matching `target`.
|
@@ -370,10 +403,43 @@ module Hanami
|
|
370
403
|
|
371
404
|
private_class_method :index
|
372
405
|
|
406
|
+
# @since 1.3.0
|
407
|
+
# @api private
|
408
|
+
def self.rindex(content, path, target)
|
409
|
+
line_number(content, target, finder: content.method(:rindex)) or
|
410
|
+
raise ArgumentError.new("Cannot find `#{target}' inside `#{path}'.")
|
411
|
+
end
|
412
|
+
|
413
|
+
private_class_method :rindex
|
414
|
+
|
415
|
+
# @since 1.3.0
|
416
|
+
# @api private
|
417
|
+
def self._inject_line_before(path, target, contents, finder)
|
418
|
+
content = ::File.readlines(path)
|
419
|
+
i = finder.call(content, path, target)
|
420
|
+
|
421
|
+
content.insert(i, "#{contents}\n")
|
422
|
+
write(path, content)
|
423
|
+
end
|
424
|
+
|
425
|
+
private_class_method :_inject_line_before
|
426
|
+
|
427
|
+
# @since 1.3.0
|
428
|
+
# @api private
|
429
|
+
def self._inject_line_after(path, target, contents, finder)
|
430
|
+
content = ::File.readlines(path)
|
431
|
+
i = finder.call(content, path, target)
|
432
|
+
|
433
|
+
content.insert(i + 1, "#{contents}\n")
|
434
|
+
write(path, content)
|
435
|
+
end
|
436
|
+
|
437
|
+
private_class_method :_inject_line_after
|
438
|
+
|
373
439
|
# @since 1.1.0
|
374
440
|
# @api private
|
375
|
-
def self.line_number(content, target)
|
376
|
-
|
441
|
+
def self.line_number(content, target, finder: content.method(:index))
|
442
|
+
finder.call do |l|
|
377
443
|
case target
|
378
444
|
when ::String
|
379
445
|
l.include?(target)
|
data/lib/hanami/utils/hash.rb
CHANGED
@@ -217,6 +217,7 @@ module Hanami
|
|
217
217
|
# @return [Hanami::Utils::Hash] self
|
218
218
|
#
|
219
219
|
# @since 0.1.0
|
220
|
+
# @deprecated
|
220
221
|
#
|
221
222
|
# @see http://www.ruby-doc.org/core/Hash.html#method-c-5B-5D
|
222
223
|
#
|
@@ -243,6 +244,7 @@ module Hanami
|
|
243
244
|
# @return [Hash] self
|
244
245
|
#
|
245
246
|
# @since 0.1.0
|
247
|
+
# @deprecated Use {Hanami::Utils::Hash.symbolize}
|
246
248
|
#
|
247
249
|
# @example
|
248
250
|
# require 'hanami/utils/hash'
|
@@ -266,6 +268,7 @@ module Hanami
|
|
266
268
|
# @return [Hash] self
|
267
269
|
#
|
268
270
|
# @since 1.0.0
|
271
|
+
# @deprecated Use {Hanami::Utils::Hash.deep_symbolize}
|
269
272
|
#
|
270
273
|
# @example
|
271
274
|
# require 'hanami/utils/hash'
|
@@ -291,6 +294,7 @@ module Hanami
|
|
291
294
|
# @return [Hash] self
|
292
295
|
#
|
293
296
|
# @since 0.3.2
|
297
|
+
# @deprecated Use {Hanami::Utils::Hash.stringify}
|
294
298
|
#
|
295
299
|
# @example
|
296
300
|
# require 'hanami/utils/hash'
|
@@ -316,6 +320,7 @@ module Hanami
|
|
316
320
|
# @return [Hash] a deep duplicated self
|
317
321
|
#
|
318
322
|
# @since 0.3.1
|
323
|
+
# @deprecated Use {Hanami::Utils::Hash.deep_dup}
|
319
324
|
#
|
320
325
|
# @example
|
321
326
|
# require 'hanami/utils/hash'
|
@@ -383,6 +388,7 @@ module Hanami
|
|
383
388
|
# @return [Array] the keys
|
384
389
|
#
|
385
390
|
# @since 0.3.0
|
391
|
+
# @deprecated
|
386
392
|
#
|
387
393
|
# @see http://www.ruby-doc.org/core/Hash.html#method-i-keys
|
388
394
|
def keys
|
@@ -397,6 +403,7 @@ module Hanami
|
|
397
403
|
# @return [Object,nil] the value hold by the given key, if present
|
398
404
|
#
|
399
405
|
# @since 0.3.0
|
406
|
+
# @deprecated
|
400
407
|
#
|
401
408
|
# @see http://www.ruby-doc.org/core/Hash.html#method-i-keys
|
402
409
|
def delete(key)
|
@@ -410,6 +417,7 @@ module Hanami
|
|
410
417
|
# @return [Object,nil] the correspoding value, if present
|
411
418
|
#
|
412
419
|
# @since 0.3.0
|
420
|
+
# @deprecated
|
413
421
|
#
|
414
422
|
# @see http://www.ruby-doc.org/core/Hash.html#method-i-5B-5D
|
415
423
|
def [](key)
|
@@ -422,6 +430,7 @@ module Hanami
|
|
422
430
|
# @param value [Object] the value to assign
|
423
431
|
#
|
424
432
|
# @since 0.3.0
|
433
|
+
# @deprecated
|
425
434
|
#
|
426
435
|
# @see http://www.ruby-doc.org/core/Hash.html#method-i-5B-5D-3D
|
427
436
|
def []=(key, value)
|
@@ -433,6 +442,7 @@ module Hanami
|
|
433
442
|
# @return [::Hash] the hash
|
434
443
|
#
|
435
444
|
# @since 0.3.0
|
445
|
+
# @deprecated
|
436
446
|
#
|
437
447
|
# @see http://www.ruby-doc.org/core/Hash.html#method-i-to_h
|
438
448
|
def to_h
|
@@ -449,6 +459,7 @@ module Hanami
|
|
449
459
|
# @return [::Array] the array
|
450
460
|
#
|
451
461
|
# @since 0.3.0
|
462
|
+
# @deprecated
|
452
463
|
#
|
453
464
|
# @see http://www.ruby-doc.org/core/Hash.html#method-i-to_a
|
454
465
|
def to_a
|
@@ -460,6 +471,7 @@ module Hanami
|
|
460
471
|
# @return [TrueClass,FalseClass]
|
461
472
|
#
|
462
473
|
# @since 0.3.0
|
474
|
+
# @deprecated
|
463
475
|
def ==(other)
|
464
476
|
@hash == other.to_h
|
465
477
|
end
|
@@ -471,6 +483,7 @@ module Hanami
|
|
471
483
|
# @return [Fixnum]
|
472
484
|
#
|
473
485
|
# @since 0.3.0
|
486
|
+
# @deprecated
|
474
487
|
def hash
|
475
488
|
@hash.hash
|
476
489
|
end
|
@@ -480,6 +493,7 @@ module Hanami
|
|
480
493
|
# @return [String]
|
481
494
|
#
|
482
495
|
# @since 0.3.0
|
496
|
+
# @deprecated
|
483
497
|
def inspect
|
484
498
|
@hash.inspect
|
485
499
|
end
|
data/lib/hanami/utils/kernel.rb
CHANGED
data/lib/hanami/utils/string.rb
CHANGED
@@ -129,8 +129,8 @@ module Hanami
|
|
129
129
|
# Hanami::Utils::String.transform("Cherry", -> { "blossom" }))
|
130
130
|
# # => ArgumentError: wrong number of arguments (given 1, expected 0)
|
131
131
|
#
|
132
|
-
# rubocop:disable Metrics/MethodLength
|
133
132
|
# rubocop:disable Metrics/AbcSize
|
133
|
+
# rubocop:disable Metrics/MethodLength
|
134
134
|
def self.transform(input, *transformations)
|
135
135
|
fn = @__transformations__.fetch_or_store(transformations.hash) do
|
136
136
|
compose do |fns|
|
@@ -150,8 +150,8 @@ module Hanami
|
|
150
150
|
|
151
151
|
fn.call(input)
|
152
152
|
end
|
153
|
-
# rubocop:enable Metrics/AbcSize
|
154
153
|
# rubocop:enable Metrics/MethodLength
|
154
|
+
# rubocop:enable Metrics/AbcSize
|
155
155
|
|
156
156
|
# Extracted from `transproc` source code
|
157
157
|
#
|
@@ -323,6 +323,7 @@ module Hanami
|
|
323
323
|
# @since 1.1.0
|
324
324
|
#
|
325
325
|
# @see Hanami::Utils::Inflector
|
326
|
+
# @deprecated
|
326
327
|
#
|
327
328
|
# @example
|
328
329
|
# require 'hanami/utils/string'
|
@@ -340,6 +341,7 @@ module Hanami
|
|
340
341
|
# @return [::String] the singularized string.
|
341
342
|
#
|
342
343
|
# @since 1.1.0
|
344
|
+
# @deprecated
|
343
345
|
#
|
344
346
|
# @see Hanami::Utils::Inflector
|
345
347
|
#
|
@@ -389,6 +391,7 @@ module Hanami
|
|
389
391
|
# @return [Hanami::Utils::String] self
|
390
392
|
#
|
391
393
|
# @since 0.1.0
|
394
|
+
# @deprecated
|
392
395
|
def initialize(string)
|
393
396
|
@string = string.to_s
|
394
397
|
end
|
@@ -398,6 +401,7 @@ module Hanami
|
|
398
401
|
# @return [Hanami::Utils::String] the transformed string
|
399
402
|
#
|
400
403
|
# @since 0.4.0
|
404
|
+
# @deprecated Use {Hanami::Utils::String.titleize}
|
401
405
|
#
|
402
406
|
# @example
|
403
407
|
# require 'hanami/utils/string'
|
@@ -413,6 +417,7 @@ module Hanami
|
|
413
417
|
# @return [Hanami::Utils::String] the transformed string
|
414
418
|
#
|
415
419
|
# @since 0.5.2
|
420
|
+
# @deprecated Use {Hanami::Utils::String.capitalize}
|
416
421
|
#
|
417
422
|
# @example
|
418
423
|
# require 'hanami/utils/string'
|
@@ -444,6 +449,7 @@ module Hanami
|
|
444
449
|
# @return [Hanami::Utils::String] the transformed string
|
445
450
|
#
|
446
451
|
# @since 0.1.0
|
452
|
+
# @deprecated Use {Hanami::Utils::String.classify}
|
447
453
|
#
|
448
454
|
# @example
|
449
455
|
# require 'hanami/utils/string'
|
@@ -467,6 +473,7 @@ module Hanami
|
|
467
473
|
# @see https://github.com/rails/rails/blob/feaa6e2048fe86bcf07e967d6e47b865e42e055b/activesupport/lib/active_support/inflector/methods.rb#L90
|
468
474
|
#
|
469
475
|
# @return [Hanami::Utils::String] the transformed string
|
476
|
+
# @deprecated Use {Hanami::Utils::String.underscore}
|
470
477
|
#
|
471
478
|
# @since 0.1.0
|
472
479
|
#
|
@@ -489,6 +496,7 @@ module Hanami
|
|
489
496
|
# @return [Hanami::Utils::String] the transformed string
|
490
497
|
#
|
491
498
|
# @since 0.4.0
|
499
|
+
# @deprecated Use {Hanami::Utils::String.dasherize}
|
492
500
|
#
|
493
501
|
# @example
|
494
502
|
# require 'hanami/utils/string'
|
@@ -510,6 +518,7 @@ module Hanami
|
|
510
518
|
# @return [Hanami::Utils::String] the transformed string
|
511
519
|
#
|
512
520
|
# @since 0.1.0
|
521
|
+
# @deprecated Use {Hanami::Utils::String.demodulize}
|
513
522
|
#
|
514
523
|
# @example
|
515
524
|
# require 'hanami/utils/string'
|
@@ -528,6 +537,7 @@ module Hanami
|
|
528
537
|
# @return [Hanami::Utils::String] the transformed string
|
529
538
|
#
|
530
539
|
# @since 0.1.2
|
540
|
+
# @deprecated Use {Hanami::Utils::String.namespace}
|
531
541
|
#
|
532
542
|
# @example
|
533
543
|
# require 'hanami/utils/string'
|
@@ -549,6 +559,7 @@ module Hanami
|
|
549
559
|
# @return [void]
|
550
560
|
#
|
551
561
|
# @since 0.1.0
|
562
|
+
# @deprecated
|
552
563
|
#
|
553
564
|
# @example
|
554
565
|
# require 'hanami/utils/string'
|
@@ -561,7 +572,9 @@ module Hanami
|
|
561
572
|
# # =>
|
562
573
|
# 'Hanami::Utils'
|
563
574
|
# 'Hanami::App'
|
564
|
-
|
575
|
+
#
|
576
|
+
# rubocop:disable Metrics/MethodLength
|
577
|
+
def tokenize
|
565
578
|
if match = TOKENIZE_REGEXP.match(@string) # rubocop:disable Lint/AssignmentInCondition
|
566
579
|
pre = match.pre_match
|
567
580
|
post = match.post_match
|
@@ -575,6 +588,7 @@ module Hanami
|
|
575
588
|
|
576
589
|
nil
|
577
590
|
end
|
591
|
+
# rubocop:enable Metrics/MethodLength
|
578
592
|
|
579
593
|
# Return a pluralized version of self.
|
580
594
|
#
|
@@ -582,6 +596,7 @@ module Hanami
|
|
582
596
|
#
|
583
597
|
# @api private
|
584
598
|
# @since 0.4.1
|
599
|
+
# @deprecated
|
585
600
|
#
|
586
601
|
# @see Hanami::Utils::Inflector
|
587
602
|
def pluralize
|
@@ -594,6 +609,7 @@ module Hanami
|
|
594
609
|
#
|
595
610
|
# @api private
|
596
611
|
# @since 0.4.1
|
612
|
+
# @deprecated
|
597
613
|
#
|
598
614
|
# @see Hanami::Utils::Inflector
|
599
615
|
def singularize
|
@@ -605,6 +621,7 @@ module Hanami
|
|
605
621
|
# @return [Integer]
|
606
622
|
#
|
607
623
|
# @since 0.3.0
|
624
|
+
# @deprecated
|
608
625
|
def hash
|
609
626
|
@string.hash
|
610
627
|
end
|
@@ -614,6 +631,7 @@ module Hanami
|
|
614
631
|
# @return [::String]
|
615
632
|
#
|
616
633
|
# @since 0.3.0
|
634
|
+
# @deprecated
|
617
635
|
def to_s
|
618
636
|
@string
|
619
637
|
end
|
@@ -625,6 +643,7 @@ module Hanami
|
|
625
643
|
# @return [TrueClass,FalseClass]
|
626
644
|
#
|
627
645
|
# @since 0.3.0
|
646
|
+
# @deprecated
|
628
647
|
def ==(other)
|
629
648
|
to_s == other
|
630
649
|
end
|
@@ -638,6 +657,7 @@ module Hanami
|
|
638
657
|
# @see http://www.ruby-doc.org/core/String.html#method-i-split
|
639
658
|
#
|
640
659
|
# @since 0.3.0
|
660
|
+
# @deprecated
|
641
661
|
def split(pattern, limit = 0)
|
642
662
|
@string.split(pattern, limit)
|
643
663
|
end
|
@@ -649,6 +669,7 @@ module Hanami
|
|
649
669
|
# @see http://www.ruby-doc.org/core/String.html#method-i-gsub
|
650
670
|
#
|
651
671
|
# @since 0.3.0
|
672
|
+
# @deprecated
|
652
673
|
def gsub(pattern, replacement = nil, &blk)
|
653
674
|
if block_given?
|
654
675
|
@string.gsub(pattern, &blk)
|
@@ -665,6 +686,7 @@ module Hanami
|
|
665
686
|
# @see http://www.ruby-doc.org/core/String.html#method-i-scan
|
666
687
|
#
|
667
688
|
# @since 0.6.0
|
689
|
+
# @deprecated
|
668
690
|
def scan(pattern, &blk)
|
669
691
|
@string.scan(pattern, &blk)
|
670
692
|
end
|
@@ -681,6 +703,7 @@ module Hanami
|
|
681
703
|
# @return [Hanami::Utils::String] the replaced string
|
682
704
|
#
|
683
705
|
# @since 0.6.0
|
706
|
+
# @deprecated Use {Hanami::Utils::String.rsub}
|
684
707
|
#
|
685
708
|
# @example
|
686
709
|
# require 'hanami/utils/string'
|
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: 1.
|
4
|
+
version: 1.3.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: transproc
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '12'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '12'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,12 +134,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: 2.3.0
|
135
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- - "
|
137
|
+
- - ">"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
139
|
+
version: 1.3.1
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.7.
|
142
|
+
rubygems_version: 2.7.7
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: Ruby core extentions and Hanami utilities
|