ivo 0.2.1 → 0.2.2
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/lib/ivo.rb +20 -0
- data/lib/ivo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fdc9a620759edc3eff979f744d48905bd09cbdd
|
4
|
+
data.tar.gz: a1c49a1b8a160c74d6ad8ab65e6f0a37a859a8dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bbbbeeeba4fec23c70e9d62ec6a23e33ced06c3eb125be401ef963722fa4f33ff0f1d164a1b2d6287e10bb52dd2efecf92f0bd21217277444c0eb305a6e01e0
|
7
|
+
data.tar.gz: b16247f008a7239b823b4bef7a353ce74a88b575093f83668c3e7c61888db68d61213a43bf0dd22603b5948a91f23a3eff3bbba671a8090cdb681addc0a1fa69
|
data/lib/ivo.rb
CHANGED
@@ -12,6 +12,14 @@ module Ivo
|
|
12
12
|
# @b = b
|
13
13
|
instance_variable_assignments = attrs.map { |attr| "@#{attr} = #{attr}" }.join "\n"
|
14
14
|
|
15
|
+
equality_check = begin
|
16
|
+
checks = ['self.class == other.class']
|
17
|
+
checks = attrs.each { checks << "#{attr} == other.#{attr}" }
|
18
|
+
checks.join ' && '
|
19
|
+
end
|
20
|
+
|
21
|
+
hash = attrs.map { |attr| "#{attr}.hash" }.join ' ^ '
|
22
|
+
|
15
23
|
code = <<~RUBY
|
16
24
|
def self.with(#{keyword_args})
|
17
25
|
new #{attrs.join ', '}
|
@@ -21,6 +29,18 @@ module Ivo
|
|
21
29
|
#{instance_variable_assignments}
|
22
30
|
freeze
|
23
31
|
end
|
32
|
+
|
33
|
+
def ==(other)
|
34
|
+
#{equality_check}
|
35
|
+
end
|
36
|
+
|
37
|
+
def eql?(other)
|
38
|
+
self == other
|
39
|
+
end
|
40
|
+
|
41
|
+
def hash
|
42
|
+
#{hash}
|
43
|
+
end
|
24
44
|
RUBY
|
25
45
|
|
26
46
|
Class.new do
|
data/lib/ivo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ivo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Schneider
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|