evt-subst_attr 1.1.0.1 → 2.2.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c564713e7662f0a43698d26b54a62518f160a3b54106d880d8600de692999983
|
4
|
+
data.tar.gz: ff04516a334e4a3b56a05215d0093468d9c400f3aedf09dec7e48019997ff1cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0e25cd5f217bf740c33cf061d0247aec276e7a39fd6a78ea5dec0da70d4d8166b82e8f52c84e0b4d57403622f090b44f99f8a11dde28f1730ab7818291523cc
|
7
|
+
data.tar.gz: ea9e18a2d11e640e705c7f523028ec08efba5c2b16d74933d870b98f3815eea532cfa037c034c70af10af9dedd26626687334fe0a3d4eab4d888121f1c059daf
|
@@ -3,18 +3,23 @@ module SubstAttr
|
|
3
3
|
module Dependency
|
4
4
|
class Example
|
5
5
|
def self.configure(receiver)
|
6
|
-
receiver.
|
6
|
+
receiver.specialized_substitute_attr = new
|
7
7
|
end
|
8
8
|
|
9
9
|
module Substitute
|
10
10
|
def self.build
|
11
|
-
:
|
11
|
+
:some_substitute
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
class Descendant < Example
|
16
16
|
end
|
17
17
|
end
|
18
|
+
|
19
|
+
module NoSubstitute
|
20
|
+
class Example
|
21
|
+
end
|
22
|
+
end
|
18
23
|
end
|
19
24
|
end
|
20
25
|
end
|
@@ -3,9 +3,11 @@ module SubstAttr
|
|
3
3
|
class Example
|
4
4
|
include SubstAttr
|
5
5
|
|
6
|
-
subst_attr :
|
6
|
+
subst_attr :specialized_substitute_attr, Dependency::Example
|
7
7
|
|
8
|
-
subst_attr :
|
8
|
+
subst_attr :strict_substitute_attr, Dependency::NoSubstitute::Example
|
9
|
+
|
10
|
+
subst_attr :weak_substitute_attr
|
9
11
|
|
10
12
|
def self.build
|
11
13
|
new.tap do |instance|
|
@@ -15,6 +15,7 @@ module SubstAttr
|
|
15
15
|
interface = receiver.send(attr_name).class
|
16
16
|
substitute = build(interface)
|
17
17
|
receiver.send :"#{attr_name}=", substitute
|
18
|
+
substitute
|
18
19
|
end
|
19
20
|
|
20
21
|
def specialization(interface)
|
@@ -28,6 +29,10 @@ module SubstAttr
|
|
28
29
|
|
29
30
|
specialization_module = reflection.constant
|
30
31
|
|
32
|
+
if specialization_module.equal?(self)
|
33
|
+
return nil
|
34
|
+
end
|
35
|
+
|
31
36
|
unless specialization_module.respond_to?(:build)
|
32
37
|
return nil
|
33
38
|
end
|
@@ -11,21 +11,17 @@ module SubstAttr
|
|
11
11
|
weak
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
def method_missing(*)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
const_set(:Weak, cls)
|
22
|
-
end
|
14
|
+
def strict(interface)
|
15
|
+
Mimic.(interface, record: false)
|
16
|
+
end
|
23
17
|
|
18
|
+
def weak
|
24
19
|
Weak.new
|
25
20
|
end
|
26
21
|
|
27
|
-
|
28
|
-
|
22
|
+
Weak = Mimic::Build.(Object, record: false) do
|
23
|
+
def method_missing(*)
|
24
|
+
end
|
29
25
|
end
|
30
26
|
end
|
31
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evt-subst_attr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Eventide Project
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-attribute
|
@@ -88,7 +88,7 @@ homepage: https://github.com/eventide-project/subst-attr
|
|
88
88
|
licenses:
|
89
89
|
- MIT
|
90
90
|
metadata: {}
|
91
|
-
post_install_message:
|
91
|
+
post_install_message:
|
92
92
|
rdoc_options: []
|
93
93
|
require_paths:
|
94
94
|
- lib
|
@@ -103,8 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
|
-
rubygems_version: 3.
|
107
|
-
signing_key:
|
106
|
+
rubygems_version: 3.2.15
|
107
|
+
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: Declare attributes that have default implementations that are substitutes
|
110
110
|
or null objects
|