wholable 1.1.0 → 1.2.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/lib/wholable/equatable.rb +8 -31
- data/wholable.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -3
- 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: f540eaa42465e5e3748ea429e05e2d6dd58cdfa8494449278171431f4cc0988e
|
4
|
+
data.tar.gz: 267f834158a1368a7c716de371d24137b99508b6b13c2ca87d741cee111bcfc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9367c1662e745c179f3ecc56e1960de2d5fd35a87535e954ae219ec04e6296ed374867024e6b091becf0724a50926d6c48b6e58e2d3fc0d5a569ff376e0678ab
|
7
|
+
data.tar.gz: ecfc4e395a5cd611b17e8e82540c1f0caf996a9105ce4f21099e915ea526063f1c8b42ff9661f2bb8a0642a583b3e04c167555dda21c8c1632aa15b9c6e3a104
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/wholable/equatable.rb
CHANGED
@@ -31,36 +31,19 @@ module Wholable
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def define_class_methods descendant
|
34
|
-
|
35
|
-
define_deconstruct descendant
|
36
|
-
define_deconstruct_keys descendant
|
37
|
-
end
|
38
|
-
|
39
|
-
def define_readers descendant
|
40
|
-
descendant.class_eval <<-READERS, __FILE__, __LINE__ + 1
|
34
|
+
descendant.class_eval <<-READER, __FILE__, __LINE__ + 1
|
41
35
|
attr_reader #{keys.map(&:inspect).join ", "}
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
def define_deconstruct descendant
|
46
|
-
descendant.class_eval <<-READERS, __FILE__, __LINE__ + 1
|
47
|
-
alias deconstruct to_a
|
48
|
-
READERS
|
49
|
-
end
|
36
|
+
READER
|
50
37
|
|
51
|
-
|
52
|
-
descendant.
|
53
|
-
alias deconstruct_keys to_h
|
54
|
-
READERS
|
38
|
+
descendant.alias_method :deconstruct, :to_a
|
39
|
+
descendant.alias_method :deconstruct_keys, :to_h
|
55
40
|
end
|
56
41
|
|
57
42
|
def define_with
|
58
43
|
define_method(:with) { |**attributes| self.class.new(**to_h.merge!(attributes)) }
|
59
44
|
end
|
60
45
|
|
61
|
-
def define_hash
|
62
|
-
local_keys = keys
|
63
|
-
|
46
|
+
def define_hash local_keys = keys
|
64
47
|
define_method :hash do
|
65
48
|
local_keys.map { |key| public_send key }
|
66
49
|
.prepend(self.class)
|
@@ -68,9 +51,7 @@ module Wholable
|
|
68
51
|
end
|
69
52
|
end
|
70
53
|
|
71
|
-
def define_inspect
|
72
|
-
local_keys = keys
|
73
|
-
|
54
|
+
def define_inspect local_keys = keys
|
74
55
|
define_method :inspect do
|
75
56
|
klass = self.class
|
76
57
|
name = klass.name || klass.inspect
|
@@ -81,17 +62,13 @@ module Wholable
|
|
81
62
|
end
|
82
63
|
end
|
83
64
|
|
84
|
-
def define_to_a
|
85
|
-
local_keys = keys
|
86
|
-
|
65
|
+
def define_to_a local_keys = keys
|
87
66
|
define_method :to_a do
|
88
67
|
local_keys.reduce([]) { |array, key| array.append public_send(key) }
|
89
68
|
end
|
90
69
|
end
|
91
70
|
|
92
|
-
def define_to_h
|
93
|
-
local_keys = keys
|
94
|
-
|
71
|
+
def define_to_h local_keys = keys
|
95
72
|
define_method :to_h do
|
96
73
|
local_keys.each.with_object({}) { |key, dictionary| dictionary[key] = public_send key }
|
97
74
|
end
|
data/wholable.gemspec
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wholable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
36
|
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2024-
|
38
|
+
date: 2024-04-01 00:00:00.000000000 Z
|
39
39
|
dependencies: []
|
40
40
|
description:
|
41
41
|
email:
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
|
-
rubygems_version: 3.5.
|
82
|
+
rubygems_version: 3.5.7
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: A whole value object mixin.
|
metadata.gz.sig
CHANGED
Binary file
|