init_copy 0.2.0 → 0.3.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: 1620d2aa498e981be870fd3e0d671595b0407e557b54e40cf7e32b38b95158a8
4
- data.tar.gz: 1b08062be47d208e59ed5a70e548f726d55936ccc000a84bbda5b2ed47119360
3
+ metadata.gz: f2ea381fdf2b5c0bec710f2b219f87e2f897e8bba17246591982617e02a5024c
4
+ data.tar.gz: c33f202bb2301400918c86fc49a8acf0a43be8f82f5e7e2df1dc6ca9935fc4c4
5
5
  SHA512:
6
- metadata.gz: 17b1bc267564f9f49c5b699581f522690bc13a63addbab7708bbb6af227970f3701c0f259d00d0d42b4c898e5b349324672b416395d5d0d34be151cf48994db0
7
- data.tar.gz: e2973b90f3bd28a061904a1db08435b2f2a5af11c2a7bc4d14ce1a40bfbc7837099b0c8c786ea39b064714b041d87994420890ff6f6ae30afb621dac6f31d89b
6
+ metadata.gz: 36b93091f59641bf0ea2fc2a7c520815f285e24aa5136d7e03c1e837811084f2b62e6040f82e98a1facd9e6b0930834558f7df7783cfe01a60a17b20d99152c9
7
+ data.tar.gz: fb2e3f6d74272af1061f73794814874bdb7d76f16c7998fdd9cfd41d1c5d17a7eda9985a0e0724be9fa16e1a55ba64f557ae431d93eff9a2637fc6bffab1312f
data/.rdoc_options CHANGED
@@ -11,6 +11,7 @@ embed_mixins: true
11
11
  force_update: true
12
12
  hyperlink_all: true
13
13
  line_numbers: true
14
+ markup: markdown
14
15
  show_hash: true
15
16
  skip_tests: true
16
17
 
data/Gemfile CHANGED
@@ -6,11 +6,11 @@ source 'https://rubygems.org'
6
6
  gemspec
7
7
 
8
8
  group :development,:test do
9
- gem 'bundler' ,'~> 2.6'
10
- gem 'rake' ,'~> 13.3'
11
- gem 'rdoc' ,'~> 6.14'
9
+ gem 'bundler' ,'~> 2.6 '
10
+ gem 'rake' ,'~> 13.3 '
11
+ gem 'rdoc' ,'~> 6.14'
12
12
  end
13
13
 
14
14
  group :test do
15
- gem 'minitest' ,'~> 5.25'
15
+ gem 'minitest','~> 5.25'
16
16
  end
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/init_copy.svg)](https://badge.fury.io/rb/init_copy)
4
4
  [![CI Status](https://github.com/esotericpig/init_copy/actions/workflows/ci.yml/badge.svg)](https://github.com/esotericpig/init_copy/actions/workflows/ci.yml)
5
-
6
5
  [![Source Code](https://img.shields.io/badge/source-github-%23211F1F.svg)](https://github.com/esotericpig/init_copy)
7
6
  [![Changelog](https://img.shields.io/badge/changelog-md-%23A0522D.svg)](CHANGELOG.md)
8
7
  [![License](https://img.shields.io/github/license/esotericpig/init_copy.svg)](LICENSE.txt)
@@ -18,6 +17,7 @@ module SecretExt
18
17
  end
19
18
  end
20
19
 
20
+ # Init vars.
21
21
  bob = 'Bob'
22
22
  bob.extend(SecretExt)
23
23
  bob.freeze
@@ -25,6 +25,7 @@ bob.freeze
25
25
  clone = bob.clone
26
26
  dup = bob.dup
27
27
 
28
+ # Check vars.
28
29
  puts clone.frozen? #=> true
29
30
  puts dup.frozen? #=> false
30
31
 
@@ -35,8 +36,9 @@ puts dup.secret #=> NoMethodError
35
36
  To solve this issue in the past, we had to define both `initialize_clone` & `initialize_dup` and maintain two copies of all our deep-copy code. That sucks. 😞
36
37
 
37
38
  🚀 Instead, *InitCopy* was created:
38
- 1. Install the gem `init_copy` ([RubyGems.org page](https://rubygems.org/gems/init_copy)).
39
- 2. Include `InitCopy` in your class/module.
39
+
40
+ 1. Install the gem `init_copy` ([on RubyGems.org](https://rubygems.org/gems/init_copy)).
41
+ 2. Include `InitCopy::Able` in your class/module.
40
42
  3. Override the `init_copy(original)` method.
41
43
  4. Use `ic_copy(var)`, instead of clone/dup.
42
44
 
@@ -46,14 +48,15 @@ Example usage:
46
48
  require 'init_copy'
47
49
 
48
50
  class JangoFett
49
- include InitCopy
51
+ include InitCopy::Able
50
52
 
51
- attr_reader :gear,:order66
53
+ attr_reader :gear,:bounties,:order66
52
54
 
53
55
  def initialize
54
56
  super
55
57
 
56
58
  @gear = ['blaster','jetpack']
59
+ @bounties = ['Padmé','Vosa']
57
60
 
58
61
  @order66 = Class.new do
59
62
  undef_method :clone
@@ -67,12 +70,15 @@ class JangoFett
67
70
  super
68
71
 
69
72
  @gear = ic_copy(@gear)
73
+ @bounties = ic_copy(@bounties)
74
+
70
75
  @order66 = ic_copy?(@order66) # Safe copy if no dup/clone.
71
76
  end
72
77
  end
73
78
 
79
+ # Init vars.
74
80
  jango = JangoFett.new
75
- jango.freeze
81
+ jango.bounties.freeze
76
82
 
77
83
  boba1 = jango.clone
78
84
  boba2 = jango.dup
@@ -80,13 +86,17 @@ boba2 = jango.dup
80
86
  jango.gear << 'vibroblade'
81
87
  boba1.gear << 'implant'
82
88
 
83
- puts jango.gear.inspect #=> ["blaster", "jetpack", "vibroblade"]
89
+ # Check vars.
90
+ puts jango.gear.inspect #=> ["blaster", "jetpack", "vibroblade"]
84
91
 
85
- puts boba1.gear.inspect #=> ["blaster", "jetpack", "implant"]
86
- puts boba2.gear.inspect #=> ["blaster", "jetpack"]
92
+ puts boba1.gear.inspect #=> ["blaster", "jetpack", "implant"]
93
+ puts boba2.gear.inspect #=> ["blaster", "jetpack"]
87
94
 
88
- puts boba1.frozen? #=> true (clone)
89
- puts boba2.frozen? #=> false (dup)
95
+ puts boba1.bounties.inspect #=> ["Padmé", "Vosa"]
96
+ puts boba2.bounties.inspect #=> ["Padmé", "Vosa"]
97
+
98
+ puts boba1.bounties.frozen? #=> true (clone)
99
+ puts boba2.bounties.frozen? #=> false (dup)
90
100
  ```
91
101
 
92
102
  ## // Contents
@@ -114,16 +124,15 @@ spec.add_dependency 'init_copy', '~> X.X'
114
124
  In your *Gemfile*:
115
125
 
116
126
  ```ruby
117
- # Pick one...
127
+ # Pick your poison...
118
128
  gem 'init_copy', '~> X.X'
119
-
120
129
  gem 'init_copy', git: 'https://github.com/esotericpig/init_copy.git', branch: 'main'
121
130
  ```
122
131
 
123
132
  From source:
124
133
 
125
134
  ```bash
126
- git clone 'https://github.com/esotericpig/init_copy.git'
135
+ git clone --depth 1 'https://github.com/esotericpig/init_copy.git'
127
136
  cd init_copy
128
137
  bundle install
129
138
  bundle exec rake install:local
data/Rakefile CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'bundler/gem_tasks'
5
5
 
6
- require 'init_copy'
6
+ require 'init_copy/version'
7
7
  require 'rake/clean'
8
8
  require 'rake/testtask'
9
9
  require 'rdoc/task'
data/init_copy.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative 'lib/init_copy'
4
+ require_relative 'lib/init_copy/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'init_copy'
@@ -21,9 +21,8 @@ Gem::Specification.new do |spec|
21
21
  'changelog_uri' => 'https://github.com/esotericpig/init_copy/blob/main/CHANGELOG.md',
22
22
  }
23
23
 
24
- # Lowest version that isn't eol (end-of-life).
25
24
  # - https://www.ruby-lang.org/en/downloads/branches/
26
- spec.required_ruby_version = '>= 3.2'
25
+ spec.required_ruby_version = '>= 3.1'
27
26
  spec.require_paths = ['lib']
28
27
  spec.bindir = 'bin'
29
28
  spec.executables = []
@@ -0,0 +1,13 @@
1
+ # encoding: UTF-8
2
+ # frozen_string_literal: true
3
+
4
+ #--
5
+ # This file is part of InitCopy.
6
+ # Copyright (c) 2025 Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: MIT
9
+ #++
10
+
11
+ module InitCopy
12
+ VERSION = '0.3.0'
13
+ end
data/lib/init_copy.rb CHANGED
@@ -8,11 +8,13 @@
8
8
  # SPDX-License-Identifier: MIT
9
9
  #++
10
10
 
11
+ require 'init_copy/version'
12
+
11
13
  # Example usage:
12
14
  # require 'init_copy'
13
15
  #
14
16
  # class JangoFett
15
- # include InitCopy
17
+ # include InitCopy::Able
16
18
  #
17
19
  # protected
18
20
  #
@@ -24,33 +26,11 @@
24
26
  # end
25
27
  # end
26
28
  module InitCopy
27
- VERSION = '0.2.0'
28
-
29
- def self.included(mod)
30
- super
31
-
32
- # NOTE: Can't use prepend(), else children's init_copy() won't call their parents', even with super().
33
- mod.include(Copyable)
34
- end
35
-
36
- def self.extended(mod)
37
- super
38
-
39
- mod.include(Copyable)
40
- end
41
-
42
- def self.prepended(mod)
43
- super
44
-
45
- # User specifically requested to prepend.
46
- mod.prepend(Copyable)
47
- end
48
-
49
- module Copyable
29
+ module Able
50
30
  def initialize_clone(orig)
51
31
  super
52
32
 
53
- # The instance variable name is long & obnoxious to reduce conflicts.
33
+ # The instance var name is long & obnoxious to reduce conflicts.
54
34
  @__init_copy_method_name = :clone
55
35
  init_copy(orig)
56
36
  end
@@ -12,196 +12,180 @@ require 'minitest/autorun'
12
12
 
13
13
  require 'init_copy'
14
14
 
15
- class InitCopyTest < Minitest::Test
16
- # def setup
17
- # end
15
+ describe InitCopy do
16
+ it 'has a correct version' do
17
+ _(InitCopy::VERSION).must_match(/\d+\.\d+\.\d+(-[0-9A-Za-z\-.]+)?(\+[0-9A-Za-z\-.]+)?/)
18
+ end
18
19
 
19
- def test_include
20
- %i[include extend prepend].each do |method|
21
- sut_class = Class.new
22
- sut_class.__send__(method,InitCopy)
20
+ def self.add_basic_copy_tests
21
+ it 'is not the same as the copies' do
22
+ _(@sut).wont_be_same_as(@sut_clone)
23
+ _(@sut).wont_be_same_as(@sut_dup)
24
+ end
23
25
 
24
- assert_includes(sut_class.included_modules,InitCopy::Copyable,
25
- "`#{method}` of InitCopy should include InitCopy::Copyable")
26
+ it 'has the correct copy method name' do
27
+ _(@sut.init_copy_method_name).must_be_nil
28
+ _(@sut_clone.init_copy_method_name).must_equal(:clone)
29
+ _(@sut_dup.init_copy_method_name).must_equal(:dup)
26
30
  end
27
31
  end
28
32
 
29
- def test_no_copy
30
- sut = TestBag.new
31
-
32
- refute_deep_copy(sut,sut.clone,:clone)
33
- refute_deep_copy(sut,sut.dup,:dup)
34
- end
33
+ def self.add_deep_copy_tests(is_frozen: false)
34
+ it 'has the correct original' do
35
+ _(@sut.orig).must_be_nil
36
+ _(@sut_clone.orig).must_be_same_as(@sut)
37
+ _(@sut_dup.orig).must_be_same_as(@sut)
38
+ end
35
39
 
36
- def test_clone
37
- sut = TestBagWithCopy.new
40
+ it 'does a deep copy' do
41
+ _(@sut.nums).wont_be_same_as(@sut_clone.nums)
42
+ _(@sut.nums).wont_be_same_as(@sut_dup.nums)
38
43
 
39
- assert_deep_copy(sut,sut.clone,:clone)
40
- end
44
+ expected = [1,2,3]
41
45
 
42
- def test_dup
43
- sut = TestBagWithCopy.new
46
+ _(@sut.nums).must_equal(expected)
47
+ _(@sut_clone.nums).must_equal(expected)
48
+ _(@sut_dup.nums).must_equal(expected)
44
49
 
45
- assert_deep_copy(sut,sut.dup,:dup)
46
- end
50
+ if !is_frozen
51
+ @sut.nums << 4
52
+ @sut_clone.nums << 5
53
+ @sut_dup.nums << 6
47
54
 
48
- def test_correct_clone_and_dup_behavior
49
- sut_ext = Module.new do
50
- def bonus
51
- return 100
55
+ _(@sut.nums).must_equal([1,2,3,4])
56
+ _(@sut_clone.nums).must_equal([1,2,3,5])
57
+ _(@sut_dup.nums).must_equal([1,2,3,6])
52
58
  end
53
59
  end
54
-
55
- sut = TestBagWithCopy.new
56
- sut.extend(sut_ext)
57
-
58
- assert_deep_copy(sut,sut.clone,:clone)
59
- assert_deep_copy(sut,sut.dup,:dup)
60
-
61
- sut.nums.freeze
62
- sut_clone = sut.clone
63
- sut_dup = sut.dup
64
-
65
- assert_predicate(sut.nums,:frozen?,'SUT nums should be frozen')
66
- assert_respond_to(sut,:bonus,'SUT should have the bonus extension')
67
- assert_equal(100,sut.bonus)
68
-
69
- assert_predicate(sut_clone.nums,:frozen?,'clone should keep the nums as frozen')
70
- assert_respond_to(sut_clone,:bonus,'clone should keep the bonus extension')
71
- assert_equal(100,sut_clone.bonus)
72
-
73
- refute_predicate(sut_dup.nums,:frozen?,'dup should remove the internal frozen state of nums')
74
- refute_respond_to(sut_dup,:bonus,'dup should remove the bonus extension')
75
- assert_raises(NoMethodError) { sut_dup.bonus }
76
60
  end
77
61
 
78
- def test_safe_copy
79
- sut = TestBagWithSafeCopy.new
80
-
81
- assert_respond_to(sut.nums,:clone)
82
- assert_respond_to(sut.nums,:dup)
83
-
84
- assert_deep_copy(sut,sut.clone,:clone)
85
- assert_deep_copy(sut,sut.dup,:dup)
86
-
87
- class << sut.nums
88
- undef_method :clone
89
- undef_method :dup
62
+ describe 'without copy' do
63
+ before do
64
+ @sut = TestBag.new
65
+ @sut_clone = @sut.clone
66
+ @sut_dup = @sut.dup
90
67
  end
91
68
 
92
- refute_respond_to(sut.nums,:clone)
93
- refute_respond_to(sut.nums,:dup)
94
-
95
- refute_deep_copy(sut,sut.clone,:clone,is_safe_copy: true)
96
- refute_deep_copy(sut,sut.dup,:dup,is_safe_copy: true)
97
-
98
- # Make sure we didn't remove clone()/dup() for all arrays.
99
- assert_respond_to([1,2,3],:clone)
100
- assert_respond_to([1,2,3],:dup)
101
- end
102
-
103
- def test_child_copy
104
- sut_class = Class.new(TestBagWithCopy) do
105
- attr_reader :strs
106
-
107
- def initialize
108
- super
109
-
110
- @strs = %w[a b c]
111
- end
112
-
113
- def init_copy(*)
114
- super
69
+ add_basic_copy_tests
115
70
 
116
- @strs = ic_copy(@strs)
117
- end
71
+ it 'has no original' do
72
+ _(@sut.orig).must_be_nil
73
+ _(@sut_clone.orig).must_be_nil
74
+ _(@sut_dup.orig).must_be_nil
118
75
  end
119
76
 
120
- sut = sut_class.new
121
- sut_clone = sut.clone
122
- sut_dup = sut.dup
77
+ it 'does not do a deep copy' do
78
+ _(@sut.nums).must_be_same_as(@sut_clone.nums)
79
+ _(@sut.nums).must_be_same_as(@sut_dup.nums)
123
80
 
124
- assert_deep_copy(sut,sut_clone,:clone)
125
- assert_deep_copy(sut,sut_dup,:dup)
81
+ expected = [1,2,3]
126
82
 
127
- expected = %w[a b c]
83
+ _(@sut.nums).must_equal(expected)
84
+ _(@sut_clone.nums).must_equal(expected)
85
+ _(@sut_dup.nums).must_equal(expected)
128
86
 
129
- refute_same(sut.strs,sut_clone.strs)
130
- refute_same(sut.strs,sut_dup.strs)
131
- assert_equal(expected,sut.strs)
132
- assert_equal(expected,sut_clone.strs)
133
- assert_equal(expected,sut_dup.strs)
87
+ @sut.nums << 4
88
+ @sut_clone.nums << 5
89
+ @sut_dup.nums << 6
134
90
 
135
- sut.strs << 'd'
136
- sut_clone.strs << 'e'
137
- sut_dup.strs << 'f'
91
+ expected = [1,2,3,4,5,6]
138
92
 
139
- assert_equal(%w[a b c d],sut.strs)
140
- assert_equal(%w[a b c e],sut_clone.strs)
141
- assert_equal(%w[a b c f],sut_dup.strs)
93
+ _(@sut.nums).must_equal(expected)
94
+ _(@sut_clone.nums).must_equal(expected)
95
+ _(@sut_dup.nums).must_equal(expected)
96
+ end
142
97
  end
143
98
 
144
- def assert_deep_copy(sut,sut_copy,copy_method_name)
145
- refute_same(sut,sut_copy)
99
+ describe 'with copy' do
100
+ before do
101
+ @sut = TestBagWithCopy.new
102
+ @sut_clone = @sut.clone
103
+ @sut_dup = @sut.dup
104
+ end
146
105
 
147
- assert_nil(sut.init_copy_method_name)
148
- assert_equal(copy_method_name,sut_copy.init_copy_method_name)
106
+ add_basic_copy_tests
107
+ add_deep_copy_tests
108
+ end
149
109
 
150
- assert_nil(sut.orig)
151
- assert_same(sut,sut_copy.orig)
110
+ describe 'with copy and internal state' do
111
+ before do
112
+ @sut = TestBagWithCopy.new
113
+
114
+ @sut.nums.extend(
115
+ Module.new do
116
+ def bonus
117
+ return 110
118
+ end
119
+ end
120
+ )
121
+ @sut.nums.freeze
122
+
123
+ @sut_clone = @sut.clone
124
+ @sut_dup = @sut.dup
125
+ end
152
126
 
153
- expected = [1,2,3]
127
+ add_basic_copy_tests
128
+ add_deep_copy_tests(is_frozen: true)
154
129
 
155
- refute_same(sut.nums,sut_copy.nums)
156
- assert_equal(expected,sut.nums)
157
- assert_equal(expected,sut_copy.nums)
130
+ it 'has the correct bonus extension' do
131
+ _(@sut.nums).must_respond_to(:bonus,'SUT should have the nums bonus extension')
132
+ _(@sut.nums.bonus).must_equal(110)
158
133
 
159
- sut.nums << 4
160
- sut_copy.nums << 5
134
+ _(@sut_clone.nums).must_respond_to(:bonus,'clone should keep the nums bonus extension')
135
+ _(@sut_clone.nums.bonus).must_equal(110)
161
136
 
162
- assert_equal([1,2,3,4],sut.nums)
163
- assert_equal([1,2,3,5],sut_copy.nums)
137
+ _(@sut_dup.nums).wont_respond_to(:bonus,'dup should remove the nums bonus extension')
138
+ _ { @sut_dup.bonus }.must_raise(NoMethodError)
139
+ end
164
140
 
165
- # Reset.
166
- sut.nums.pop
167
- sut_copy.nums.pop
141
+ it 'has the correct frozen state' do
142
+ _(@sut.nums.frozen?).must_equal(true,'SUT should have the nums as frozen')
143
+ _(@sut_clone.nums.frozen?).must_equal(true,'clone should keep the nums as frozen')
144
+ _(@sut_dup.nums.frozen?).must_equal(false,'dup should remove the nums as frozen')
145
+ end
168
146
  end
169
147
 
170
- def refute_deep_copy(sut,sut_copy,copy_method_name,is_safe_copy: false)
171
- refute_same(sut,sut_copy)
172
-
173
- assert_nil(sut.init_copy_method_name)
174
- assert_equal(copy_method_name,sut_copy.init_copy_method_name)
148
+ describe 'child with copy and unsafe var' do
149
+ before do
150
+ @sut = TestBagChildWithCopyAndUnsafe.new
151
+ @sut_clone = @sut.clone
152
+ @sut_dup = @sut.dup
153
+ end
175
154
 
176
- assert_nil(sut.orig)
155
+ add_basic_copy_tests
156
+ add_deep_copy_tests
177
157
 
178
- if is_safe_copy
179
- assert_same(sut,sut_copy.orig)
180
- else
181
- assert_nil(sut_copy.orig)
182
- end
158
+ it 'does a deep copy of the strs' do
159
+ _(@sut.strs).wont_be_same_as(@sut_clone.strs)
160
+ _(@sut.strs).wont_be_same_as(@sut_dup.strs)
183
161
 
184
- expected = [1,2,3]
162
+ expected = %w[a b c]
185
163
 
186
- assert_same(sut.nums,sut_copy.nums)
187
- assert_equal(expected,sut.nums)
188
- assert_equal(expected,sut_copy.nums)
164
+ _(@sut.strs).must_equal(expected)
165
+ _(@sut_clone.strs).must_equal(expected)
166
+ _(@sut_dup.strs).must_equal(expected)
189
167
 
190
- sut.nums << 4
191
- sut_copy.nums << 5
168
+ @sut.strs << 'd'
169
+ @sut_clone.strs << 'e'
170
+ @sut_dup.strs << 'f'
192
171
 
193
- expected = [1,2,3,4,5]
172
+ _(@sut.strs).must_equal(%w[a b c d])
173
+ _(@sut_clone.strs).must_equal(%w[a b c e])
174
+ _(@sut_dup.strs).must_equal(%w[a b c f])
175
+ end
194
176
 
195
- assert_equal(expected,sut.nums)
196
- assert_equal(expected,sut_copy.nums)
177
+ it 'does not do a deep copy of the unsafe var' do
178
+ _(@sut.unsafe).wont_respond_to(:clone)
179
+ _(@sut.unsafe).wont_respond_to(:dup)
197
180
 
198
- # Reset.
199
- sut.nums.pop(2)
181
+ _(@sut.unsafe).must_be_same_as(@sut_clone.unsafe)
182
+ _(@sut.unsafe).must_be_same_as(@sut_dup.unsafe)
183
+ end
200
184
  end
201
185
  end
202
186
 
203
187
  class TestBag
204
- include InitCopy
188
+ include InitCopy::Able
205
189
 
206
190
  attr_reader :orig
207
191
  attr_reader :nums
@@ -230,13 +214,24 @@ class TestBagWithCopy < TestBag
230
214
  end
231
215
  end
232
216
 
233
- class TestBagWithSafeCopy < TestBag
234
- protected
217
+ class TestBagChildWithCopyAndUnsafe < TestBagWithCopy
218
+ attr_reader :strs
219
+ attr_reader :unsafe
235
220
 
236
- def init_copy(orig)
221
+ def initialize
237
222
  super
238
223
 
239
- @orig = orig
240
- @nums = ic_copy?(@nums)
224
+ @strs = %w[a b c]
225
+ @unsafe = Class.new do
226
+ undef_method :clone
227
+ undef_method :dup
228
+ end.new
229
+ end
230
+
231
+ def init_copy(*)
232
+ super
233
+
234
+ @strs = ic_copy(@strs)
235
+ @unsafe = ic_copy?(@unsafe)
241
236
  end
242
237
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: init_copy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bradley Whited
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-06 00:00:00.000000000 Z
11
+ date: 2025-06-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Easily use the correct clone or dup method in initialize_copy.
14
14
  email:
@@ -26,6 +26,7 @@ files:
26
26
  - Rakefile
27
27
  - init_copy.gemspec
28
28
  - lib/init_copy.rb
29
+ - lib/init_copy/version.rb
29
30
  - test/init_copy_test.rb
30
31
  homepage: https://github.com/esotericpig/init_copy
31
32
  licenses:
@@ -45,14 +46,14 @@ rdoc_options:
45
46
  - "--main"
46
47
  - README.md
47
48
  - "--title"
48
- - InitCopy v0.2.0
49
+ - InitCopy v0.3.0
49
50
  require_paths:
50
51
  - lib
51
52
  required_ruby_version: !ruby/object:Gem::Requirement
52
53
  requirements:
53
54
  - - ">="
54
55
  - !ruby/object:Gem::Version
55
- version: '3.2'
56
+ version: '3.1'
56
57
  required_rubygems_version: !ruby/object:Gem::Requirement
57
58
  requirements:
58
59
  - - ">="