evt-subst_attr 1.0.0.0 → 2.1.0.3
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/subst_attr.rb +2 -2
- data/lib/subst_attr/substitute.rb +1 -30
- data/lib/subst_attr/substitute/null_object.rb +28 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cd9e0e75afa44800d3af10e87c289aaac6955c0c5d679eff4f36e95f2592436
|
4
|
+
data.tar.gz: 3a61d8de2af93bfa4d1341784461a1db4b02299528aea709ca792b7661cf1f68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59b316523005e8cf28b9b493a04bcfc5c08494784b0f9b8da825265bd36246c7b51931c816eea9e6c7175f357bbbaa42760f7fd7b59cce1777bb33f11db7a946
|
7
|
+
data.tar.gz: da367377a46cd31c69caa583f6d6a9976e80fff8034a03cf9f4898ab4dfa9c8e5c8c5c9f245b413324571ca246338151675293cdba2a79e4cc2e8ed8cc7fee2c
|
data/lib/subst_attr.rb
CHANGED
@@ -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)
|
@@ -34,35 +35,5 @@ module SubstAttr
|
|
34
35
|
|
35
36
|
specialization_module.send(:build)
|
36
37
|
end
|
37
|
-
|
38
|
-
module NullObject
|
39
|
-
extend self
|
40
|
-
|
41
|
-
Weak = Naught.build do |config|
|
42
|
-
config.define_explicit_conversions
|
43
|
-
config.define_implicit_conversions
|
44
|
-
config.predicates_return false
|
45
|
-
config.singleton
|
46
|
-
end
|
47
|
-
|
48
|
-
def build(interface=nil)
|
49
|
-
if interface
|
50
|
-
return strict(interface)
|
51
|
-
end
|
52
|
-
|
53
|
-
weak
|
54
|
-
end
|
55
|
-
|
56
|
-
def weak
|
57
|
-
Weak.get
|
58
|
-
end
|
59
|
-
|
60
|
-
def strict(interface)
|
61
|
-
Naught.build do |config|
|
62
|
-
config.singleton
|
63
|
-
config.impersonate(interface)
|
64
|
-
end.get
|
65
|
-
end
|
66
|
-
end
|
67
38
|
end
|
68
39
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module SubstAttr
|
2
|
+
module Substitute
|
3
|
+
module NullObject
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def build(interface=nil)
|
7
|
+
if interface
|
8
|
+
return strict(interface)
|
9
|
+
end
|
10
|
+
|
11
|
+
weak
|
12
|
+
end
|
13
|
+
|
14
|
+
def strict(interface)
|
15
|
+
Mimic.(interface, record: false)
|
16
|
+
end
|
17
|
+
|
18
|
+
def weak
|
19
|
+
Weak.new
|
20
|
+
end
|
21
|
+
|
22
|
+
Weak = Mimic::Build.(Object, record: false) do
|
23
|
+
def method_missing(*)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
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: 1.0.
|
4
|
+
version: 2.1.0.3
|
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: 2020-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-attribute
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: evt-mimic
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -83,11 +83,12 @@ files:
|
|
83
83
|
- lib/subst_attr/macro.rb
|
84
84
|
- lib/subst_attr/subst_attr.rb
|
85
85
|
- lib/subst_attr/substitute.rb
|
86
|
+
- lib/subst_attr/substitute/null_object.rb
|
86
87
|
homepage: https://github.com/eventide-project/subst-attr
|
87
88
|
licenses:
|
88
89
|
- MIT
|
89
90
|
metadata: {}
|
90
|
-
post_install_message:
|
91
|
+
post_install_message:
|
91
92
|
rdoc_options: []
|
92
93
|
require_paths:
|
93
94
|
- lib
|
@@ -102,9 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
103
|
- !ruby/object:Gem::Version
|
103
104
|
version: '0'
|
104
105
|
requirements: []
|
105
|
-
|
106
|
-
|
107
|
-
signing_key:
|
106
|
+
rubygems_version: 3.1.2
|
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
|