evt-subst_attr 1.0.0.0 → 2.1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '034905032837760f191110505c6490ace80dbd4827c2feb73ebc15f7912389c9'
4
- data.tar.gz: bd449f74635db00b315089845aa8e7b911c76771fe20d4515b5b132fec959738
3
+ metadata.gz: 7cd9e0e75afa44800d3af10e87c289aaac6955c0c5d679eff4f36e95f2592436
4
+ data.tar.gz: 3a61d8de2af93bfa4d1341784461a1db4b02299528aea709ca792b7661cf1f68
5
5
  SHA512:
6
- metadata.gz: ddfea170c63a61c38ef77040ad402aeb47078d16abd6ba42c17a8a2172ed47e42e7895bc6e675d9fd8319042eec89d163d34fa1e1789491187a90eaf90f55813
7
- data.tar.gz: e806d83737e64b862371e3e6e9a19648b04a357d5467f3a4ac90d656bb140fb2a0c9f9c11c8f78c9cad5ee454d238516693ffde732b95f5f468a29ebcb261e12
6
+ metadata.gz: 59b316523005e8cf28b9b493a04bcfc5c08494784b0f9b8da825265bd36246c7b51931c816eea9e6c7175f357bbbaa42760f7fd7b59cce1777bb33f11db7a946
7
+ data.tar.gz: da367377a46cd31c69caa583f6d6a9976e80fff8034a03cf9f4898ab4dfa9c8e5c8c5c9f245b413324571ca246338151675293cdba2a79e4cc2e8ed8cc7fee2c
@@ -1,8 +1,8 @@
1
- require 'naught'
2
-
1
+ require 'mimic'
3
2
  require 'attribute'
4
3
  require 'reflect'
5
4
 
5
+ require 'subst_attr/substitute/null_object'
6
6
  require 'subst_attr/substitute'
7
7
  require 'subst_attr/attribute'
8
8
  require 'subst_attr/macro'
@@ -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.0.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: 2018-11-04 00:00:00.000000000 Z
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: naught
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
- rubyforge_project:
106
- rubygems_version: 2.7.6
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