sixarm_ruby_equal_instance_variables 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/sixarm_ruby_equal_instance_variables.rb +1 -13
- data/lib/sixarm_ruby_equal_instance_variables/equal_instance_variables.rb +14 -0
- data/test/sixarm_ruby_equal_instance_variables_test.rb +0 -76
- data/test/sixarm_ruby_equal_instance_variables_test/equal_instance_variables_test.rb +74 -0
- metadata +102 -19
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c807757970f56aef87f3f6953425c42d52fd276d942a18ec640f10ba2a4eec20
|
4
|
+
data.tar.gz: ee64d28c51022b73cba9f6ca564bb2b189805a3603d8cec0a0cec12c8d1ba75d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eea0c3d1b4dc7029ad46e4f2e90d13bbe67e220a2516e92fb325540955183ad7b4528b4eba50dc1e95c87eaaa0d0999412551544b50ea8f6e03b2cf33b12fea
|
7
|
+
data.tar.gz: c6cfacd5aa3c402e6784e0d110b6832427292d78202e90fd6e814783e188aff582f5dbafc198e668bc7304a996d8a04429f66634711611804458cc43fbae94fc
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -1,14 +1,2 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
Please see README
|
4
|
-
=end
|
5
|
-
|
6
|
-
module EqualInstanceVariables
|
7
|
-
def ==(other)
|
8
|
-
self.class == other.class &&
|
9
|
-
self.instance_variables == other.instance_variables &&
|
10
|
-
self.instance_variables.all?{|var|
|
11
|
-
self.instance_variable_get(var) == other.instance_variable_get(var)
|
12
|
-
}
|
13
|
-
end
|
14
|
-
end
|
2
|
+
require_relative "sixarm_ruby_equal_instance_variables/equal_instance_variables"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin rdoc
|
3
|
+
Please see README
|
4
|
+
=end
|
5
|
+
|
6
|
+
module EqualInstanceVariables
|
7
|
+
def ==(other)
|
8
|
+
self.class == other.class &&
|
9
|
+
self.instance_variables == other.instance_variables &&
|
10
|
+
self.instance_variables.all?{|var|
|
11
|
+
self.instance_variable_get(var) == other.instance_variable_get(var)
|
12
|
+
}
|
13
|
+
end
|
14
|
+
end
|
@@ -1,84 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require "minitest/autorun"
|
3
|
-
#require "minitest/benchmark" if ENV["BENCH"]
|
4
|
-
require "coveralls"
|
5
3
|
require "simplecov"
|
6
|
-
Coveralls.wear!
|
7
4
|
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
8
5
|
SimpleCov::Formatter::HTMLFormatter,
|
9
|
-
Coveralls::SimpleCov::Formatter
|
10
6
|
])
|
11
7
|
SimpleCov.start
|
12
8
|
require "sixarm_ruby_equal_instance_variables"
|
13
|
-
|
14
|
-
describe EqualInstanceVariables do
|
15
|
-
|
16
|
-
class C
|
17
|
-
include EqualInstanceVariables
|
18
|
-
end
|
19
|
-
|
20
|
-
class D
|
21
|
-
include EqualInstanceVariables
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "==" do
|
25
|
-
|
26
|
-
describe "with same class, same variables, same values" do
|
27
|
-
|
28
|
-
before do
|
29
|
-
@a = C.new; @a.instance_variable_set("@name", "value")
|
30
|
-
@b = C.new; @b.instance_variable_set("@name", "value")
|
31
|
-
end
|
32
|
-
|
33
|
-
it "return true" do
|
34
|
-
expect(@a == @b).must_be_same_as true
|
35
|
-
expect(@b == @a).must_be_same_as true
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
describe "with different classes, same variables, same values" do
|
41
|
-
|
42
|
-
before do
|
43
|
-
@a = C.new; @a.instance_variable_set("@name", "value")
|
44
|
-
@b = D.new; @b.instance_variable_set("@name", "value")
|
45
|
-
end
|
46
|
-
|
47
|
-
it "return false because the class is different" do
|
48
|
-
expect(@a == @b).must_be_same_as false
|
49
|
-
expect(@b == @a).must_be_same_as false
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "with same classes, different variables, same values" do
|
55
|
-
|
56
|
-
before do
|
57
|
-
@a = C.new; @a.instance_variable_set("@name1", "value")
|
58
|
-
@b = C.new; @b.instance_variable_set("@name2", "value")
|
59
|
-
end
|
60
|
-
|
61
|
-
it "return false because the variables are different" do
|
62
|
-
expect(@a == @b).must_be_same_as false
|
63
|
-
expect(@b == @a).must_be_same_as false
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
describe "with same classes, same variables, different values" do
|
69
|
-
|
70
|
-
before do
|
71
|
-
@a = C.new; @a.instance_variable_set("@name", "value1")
|
72
|
-
@b = C.new; @b.instance_variable_set("@name", "value2")
|
73
|
-
end
|
74
|
-
|
75
|
-
it "return false because the variables are different" do
|
76
|
-
expect(@a == @b).must_be_same_as false
|
77
|
-
expect(@b == @a).must_be_same_as false
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "sixarm_ruby_equal_instance_variables_test"
|
3
|
+
|
4
|
+
describe EqualInstanceVariables do
|
5
|
+
|
6
|
+
class C
|
7
|
+
include EqualInstanceVariables
|
8
|
+
end
|
9
|
+
|
10
|
+
class D
|
11
|
+
include EqualInstanceVariables
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "==" do
|
15
|
+
|
16
|
+
describe "with same class, same variables, same values" do
|
17
|
+
|
18
|
+
before do
|
19
|
+
@a = C.new; @a.instance_variable_set("@name", "value")
|
20
|
+
@b = C.new; @b.instance_variable_set("@name", "value")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "return true" do
|
24
|
+
expect(@a == @b).must_be_same_as true
|
25
|
+
expect(@b == @a).must_be_same_as true
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "with different classes, same variables, same values" do
|
31
|
+
|
32
|
+
before do
|
33
|
+
@a = C.new; @a.instance_variable_set("@name", "value")
|
34
|
+
@b = D.new; @b.instance_variable_set("@name", "value")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "return false because the class is different" do
|
38
|
+
expect(@a == @b).must_be_same_as false
|
39
|
+
expect(@b == @a).must_be_same_as false
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "with same classes, different variables, same values" do
|
45
|
+
|
46
|
+
before do
|
47
|
+
@a = C.new; @a.instance_variable_set("@name1", "value")
|
48
|
+
@b = C.new; @b.instance_variable_set("@name2", "value")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "return false because the variables are different" do
|
52
|
+
expect(@a == @b).must_be_same_as false
|
53
|
+
expect(@b == @a).must_be_same_as false
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "with same classes, same variables, different values" do
|
59
|
+
|
60
|
+
before do
|
61
|
+
@a = C.new; @a.instance_variable_set("@name", "value1")
|
62
|
+
@b = C.new; @b.instance_variable_set("@name", "value2")
|
63
|
+
end
|
64
|
+
|
65
|
+
it "return false because the variables are different" do
|
66
|
+
expect(@a == @b).must_be_same_as false
|
67
|
+
expect(@b == @a).must_be_same_as false
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sixarm_ruby_equal_instance_variables
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SixArm
|
@@ -39,7 +39,7 @@ cert_chain:
|
|
39
39
|
tzpk/VnZXj7Ek/earx+N/Z+Wtnl2xENm5IF8SFPeI1HFa9NH47pqtxF1YKpNIEVc
|
40
40
|
2xa2BNHSePe7tys/2hbmZuyMu8X5ERmovsabSXB3a+YwtJh5c2jhA21wF7986s0q
|
41
41
|
-----END CERTIFICATE-----
|
42
|
-
date: 2018-
|
42
|
+
date: 2018-07-07 00:00:00.000000000 Z
|
43
43
|
dependencies:
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: minitest
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
requirements:
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 5.
|
50
|
+
version: 5.11.3
|
51
51
|
- - "<"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '6'
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 5.
|
60
|
+
version: 5.11.3
|
61
61
|
- - "<"
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '6'
|
@@ -85,29 +85,29 @@ dependencies:
|
|
85
85
|
name: rake
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
90
|
+
version: 12.3.1
|
91
91
|
- - "<"
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
93
|
+
version: '13'
|
94
94
|
type: :development
|
95
95
|
prerelease: false
|
96
96
|
version_requirements: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
|
-
- - "
|
98
|
+
- - ">="
|
99
99
|
- !ruby/object:Gem::Version
|
100
|
-
version:
|
100
|
+
version: 12.3.1
|
101
101
|
- - "<"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '13'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: simplecov
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.16.1
|
111
111
|
- - "<"
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '2'
|
@@ -117,30 +117,110 @@ dependencies:
|
|
117
117
|
requirements:
|
118
118
|
- - ">="
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version: 0.
|
120
|
+
version: 0.16.1
|
121
121
|
- - "<"
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '2'
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
|
-
name:
|
125
|
+
name: flog
|
126
126
|
requirement: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version:
|
130
|
+
version: 4.6.2
|
131
131
|
- - "<"
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: '
|
133
|
+
version: '5'
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
138
|
- - ">="
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version:
|
140
|
+
version: 4.6.2
|
141
141
|
- - "<"
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: '
|
143
|
+
version: '5'
|
144
|
+
- !ruby/object:Gem::Dependency
|
145
|
+
name: flay
|
146
|
+
requirement: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: 2.12.0
|
151
|
+
- - "<"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '3'
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 2.12.0
|
161
|
+
- - "<"
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '3'
|
164
|
+
- !ruby/object:Gem::Dependency
|
165
|
+
name: reek
|
166
|
+
requirement: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: 4.8.1
|
171
|
+
- - "<"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '5'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 4.8.1
|
181
|
+
- - "<"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '5'
|
184
|
+
- !ruby/object:Gem::Dependency
|
185
|
+
name: rubycritic
|
186
|
+
requirement: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: 3.4.0
|
191
|
+
- - "<"
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '4'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: 3.4.0
|
201
|
+
- - "<"
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: '4'
|
204
|
+
- !ruby/object:Gem::Dependency
|
205
|
+
name: rubocop
|
206
|
+
requirement: !ruby/object:Gem::Requirement
|
207
|
+
requirements:
|
208
|
+
- - ">="
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: 0.57.2
|
211
|
+
- - "<"
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '1'
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ">="
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: 0.57.2
|
221
|
+
- - "<"
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '1'
|
144
224
|
description: Define the `==` method to compare two objects' classes, instance variables,
|
145
225
|
and their values
|
146
226
|
email: sixarm@sixarm.com
|
@@ -150,7 +230,9 @@ extra_rdoc_files: []
|
|
150
230
|
files:
|
151
231
|
- Rakefile
|
152
232
|
- lib/sixarm_ruby_equal_instance_variables.rb
|
233
|
+
- lib/sixarm_ruby_equal_instance_variables/equal_instance_variables.rb
|
153
234
|
- test/sixarm_ruby_equal_instance_variables_test.rb
|
235
|
+
- test/sixarm_ruby_equal_instance_variables_test/equal_instance_variables_test.rb
|
154
236
|
homepage: http://sixarm.com/
|
155
237
|
licenses:
|
156
238
|
- Apache-2.0
|
@@ -174,7 +256,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
174
256
|
requirements:
|
175
257
|
- - ">="
|
176
258
|
- !ruby/object:Gem::Version
|
177
|
-
version: '2.
|
259
|
+
version: '2.5'
|
178
260
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
261
|
requirements:
|
180
262
|
- - ">="
|
@@ -182,9 +264,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
264
|
version: '0'
|
183
265
|
requirements: []
|
184
266
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.7.
|
267
|
+
rubygems_version: 2.7.7
|
186
268
|
signing_key:
|
187
269
|
specification_version: 4
|
188
270
|
summary: SixArm.com → Ruby → Equal Instance Variables method
|
189
271
|
test_files:
|
190
272
|
- test/sixarm_ruby_equal_instance_variables_test.rb
|
273
|
+
- test/sixarm_ruby_equal_instance_variables_test/equal_instance_variables_test.rb
|
metadata.gz.sig
CHANGED
Binary file
|