backports 3.20.2 → 3.21.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e5c6feae3c15c70a78dda33abcb10c737393eb6898d1756c8f3da4e5f604b25
4
- data.tar.gz: 3339a5a0ae48803b9853627c096790f555a3a8f852af7b66c4331f683fcaac55
3
+ metadata.gz: 530520a5a0baa3962a2532fde75e3cb3ee2ceac6d3c492dc72a791f8655bf5d5
4
+ data.tar.gz: d850950054b40303ba73d92ab1bd1754d40b78df0fbbf4506b4c7ac40e93e2eb
5
5
  SHA512:
6
- metadata.gz: d843af1e7bd02fe062f600df7b130c37b2ce41bf178831049bbcd57fadbb9cac1c73d9bf4feebca71dcb39998492442083822d60c1691e1e67f195e21005ea97
7
- data.tar.gz: f37e52397480aeb259cf469093980cdef01500e845b94fbe90d67864f37323d2dcdbd59fa308ada90cc7c1820a02b20c07c4a647e986840f0c9222c1b4313a35
6
+ metadata.gz: 2de1296503399822ed401d55b4482f7452f12414877564fa09237b349a951edd41bf06959a62498d335c241e13f706d7c59756519924facd599c5dfd3413fa47
7
+ data.tar.gz: 25fcaaa2d21ff9bee8b0b3328b0d73b63c451074a22938d26c80ec044b88583be429b2d2b1334f86035afd0880e534b3aca8be9203ebbc74221c71cafa5b0953
data/README.md CHANGED
@@ -231,6 +231,7 @@ itself, JRuby and Rubinius.
231
231
 
232
232
  #### String
233
233
  - `match?`
234
+ - `unpack1`
234
235
 
235
236
  #### FalseClass, Fixnum, Bignum, Float, NilClass, TrueClass
236
237
  - `dup`
@@ -0,0 +1,7 @@
1
+ unless String.method_defined? :unpack1
2
+ class String
3
+ def unpack1(fmt)
4
+ unpack(fmt)[0]
5
+ end
6
+ end
7
+ end
@@ -4,14 +4,23 @@ using ::RubyNext if defined?(::RubyNext)
4
4
 
5
5
  module Backports
6
6
  class Ractor
7
- module Cloner
8
- extend self
7
+ class Cloner
8
+ class << self
9
+ def deep_clone(obj)
10
+ return obj if Ractor.ractor_shareable_self?(obj, false) { false }
9
11
 
10
- def deep_clone(obj)
11
- return obj if Ractor.ractor_shareable_self?(obj, false) { false }
12
+ new.deep_clone(obj)
13
+ end
14
+
15
+ private :new
16
+ end
12
17
 
18
+ def initialize
13
19
  @processed = {}.compare_by_identity
14
20
  @changed = nil
21
+ end
22
+
23
+ def deep_clone(obj)
15
24
  result = process(obj) do |r|
16
25
  copy_contents(r)
17
26
  end
@@ -1,3 +1,3 @@
1
1
  module Backports
2
- VERSION = "3.20.2" unless Backports.constants.include? :VERSION # the guard is against a redefinition warning that happens on Travis
2
+ VERSION = "3.21.0" unless Backports.constants.include? :VERSION # the guard is against a redefinition warning that happens on Travis
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backports
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.20.2
4
+ version: 3.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc-André Lafortune
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-27 00:00:00.000000000 Z
11
+ date: 2021-03-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Essential backports that enable many of the nice features of Ruby for
14
14
  earlier versions.
@@ -455,6 +455,7 @@ files:
455
455
  - lib/backports/2.4.0/regexp/match.rb
456
456
  - lib/backports/2.4.0/string.rb
457
457
  - lib/backports/2.4.0/string/match.rb
458
+ - lib/backports/2.4.0/string/unpack1.rb
458
459
  - lib/backports/2.4.0/true_class.rb
459
460
  - lib/backports/2.4.0/true_class/dup.rb
460
461
  - lib/backports/2.4.rb
@@ -604,7 +605,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
604
605
  - !ruby/object:Gem::Version
605
606
  version: '0'
606
607
  requirements: []
607
- rubygems_version: 3.1.4
608
+ rubygems_version: 3.2.3
608
609
  signing_key:
609
610
  specification_version: 4
610
611
  summary: Backports of Ruby features for older Ruby.