sixarm_ruby_equal_instance_variables 1.0.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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Rakefile +10 -0
- data/lib/sixarm_ruby_equal_instance_variables.rb +14 -0
- data/test/sixarm_ruby_equal_instance_variables_test.rb +84 -0
- metadata +190 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9a905272fb8c903863d9332ece0b9a1d005152bd5a19f4f7761a1b016dc36e6d
|
4
|
+
data.tar.gz: 4fdeff97b3e095c1305d383bd5bcfb1b51d863bd6b5b46336139da2e828f83fb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d766360ae9239084fd17ef0c21c5c8ec9e11feb1e486b7dd2bf6536b81ef60ba90d5aa07a686755c66c968791fcab92e6c40557a0e57cb72c9616b6881bd4d4b
|
7
|
+
data.tar.gz: 5cefb56aac32d51536b103cf72c7e9a97fe5387bba3525610d55291201f4717a764ce3a9789165167bdfedfc6f60db38ce28cc265ad840208f47925ec8e6715b
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/Rakefile
ADDED
@@ -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
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "minitest/autorun"
|
3
|
+
#require "minitest/benchmark" if ENV["BENCH"]
|
4
|
+
require "coveralls"
|
5
|
+
require "simplecov"
|
6
|
+
Coveralls.wear!
|
7
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
8
|
+
SimpleCov::Formatter::HTMLFormatter,
|
9
|
+
Coveralls::SimpleCov::Formatter
|
10
|
+
])
|
11
|
+
SimpleCov.start
|
12
|
+
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
|
metadata
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sixarm_ruby_equal_instance_variables
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- SixArm
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIFPDCCAyQCCQDx7Y5LWGuPPzANBgkqhkiG9w0BAQsFADBgMQswCQYDVQQGEwJV
|
14
|
+
UzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEP
|
15
|
+
MA0GA1UECgwGU2l4QXJtMRMwEQYDVQQDDApzaXhhcm0uY29tMB4XDTE4MDExMzIy
|
16
|
+
NDYyM1oXDTIwMTAwOTIyNDYyM1owYDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNh
|
17
|
+
bGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDzANBgNVBAoMBlNpeEFy
|
18
|
+
bTETMBEGA1UEAwwKc2l4YXJtLmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC
|
19
|
+
AgoCggIB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V
|
34
|
+
Yl/663wZgWpqrroSnc3PE3lsuTW7quUvayjtqMTU2qrh7i21oB+/Nn+I6gcxYJZb
|
35
|
+
UlK+tvsqoM94U6sFTjw9mDt62MLQGrJtHShS+ZZiGmWj1sKreuwGJnCVDoBk15xa
|
36
|
+
oqlvfvLAMBCqlfrHhvGUfbIMgzb9uXNmCjzYMsQxuIgF6IMis6Kq02NBAR91HPMe
|
37
|
+
2RoY7CdBHMxW+O0tgS2xoQbOwb+ti1j4MbsWpCqS9Mteck0Z7jZpRRrUDjXU+/7Z
|
38
|
+
RmW9HX0oLIoCBDChCcEKG0Ma4IvHUgjv47f5iYpkXuhifiK4xMG/s+T5Euw3Wg9J
|
39
|
+
tzpk/VnZXj7Ek/earx+N/Z+Wtnl2xENm5IF8SFPeI1HFa9NH47pqtxF1YKpNIEVc
|
40
|
+
2xa2BNHSePe7tys/2hbmZuyMu8X5ERmovsabSXB3a+YwtJh5c2jhA21wF7986s0q
|
41
|
+
-----END CERTIFICATE-----
|
42
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
43
|
+
dependencies:
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: minitest
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 5.7.0
|
51
|
+
- - "<"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '6'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 5.7.0
|
61
|
+
- - "<"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '6'
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: sixarm_ruby_minitest_extensions
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.0.8
|
71
|
+
- - "<"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '2'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 1.0.8
|
81
|
+
- - "<"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '2'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rake
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 10.4.2
|
91
|
+
- - "<"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '11'
|
94
|
+
type: :development
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 10.4.2
|
101
|
+
- - "<"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '11'
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: simplecov
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.10.0
|
111
|
+
- - "<"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '2'
|
114
|
+
type: :development
|
115
|
+
prerelease: false
|
116
|
+
version_requirements: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 0.10.0
|
121
|
+
- - "<"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '2'
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: coveralls
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 0.8.2
|
131
|
+
- - "<"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '2'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 0.8.2
|
141
|
+
- - "<"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '2'
|
144
|
+
description: Define the `==` method to compare two objects' classes, instance variables,
|
145
|
+
and their values
|
146
|
+
email: sixarm@sixarm.com
|
147
|
+
executables: []
|
148
|
+
extensions: []
|
149
|
+
extra_rdoc_files: []
|
150
|
+
files:
|
151
|
+
- Rakefile
|
152
|
+
- lib/sixarm_ruby_equal_instance_variables.rb
|
153
|
+
- test/sixarm_ruby_equal_instance_variables_test.rb
|
154
|
+
homepage: http://sixarm.com/
|
155
|
+
licenses:
|
156
|
+
- Apache-2.0
|
157
|
+
- Artistic-2.0
|
158
|
+
- BSD-3-Clause
|
159
|
+
- CC-BY-NC-SA-4.0
|
160
|
+
- AGPL-3.0
|
161
|
+
- EPL-1.0
|
162
|
+
- GPL-2.0
|
163
|
+
- GPL-3.0
|
164
|
+
- LGPL-3.0
|
165
|
+
- MIT
|
166
|
+
- MPL-2.0
|
167
|
+
- Ruby
|
168
|
+
metadata: {}
|
169
|
+
post_install_message:
|
170
|
+
rdoc_options: []
|
171
|
+
require_paths:
|
172
|
+
- lib
|
173
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '2.2'
|
178
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
requirements: []
|
184
|
+
rubyforge_project:
|
185
|
+
rubygems_version: 2.7.3
|
186
|
+
signing_key:
|
187
|
+
specification_version: 4
|
188
|
+
summary: SixArm.com → Ruby → Equal Instance Variables method
|
189
|
+
test_files:
|
190
|
+
- test/sixarm_ruby_equal_instance_variables_test.rb
|
metadata.gz.sig
ADDED
Binary file
|