rggen-core 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rggen/core/base/component.rb +14 -2
- data/lib/rggen/core/base/proxy_call.rb +18 -0
- data/lib/rggen/core/input_base/component.rb +1 -8
- data/lib/rggen/core/input_base/feature.rb +4 -3
- data/lib/rggen/core/output_base/component.rb +2 -7
- data/lib/rggen/core/version.rb +1 -1
- data/lib/rggen/core.rb +1 -1
- metadata +4 -5
- data/lib/rggen/core/core_extensions/forwardable.rb +0 -12
- data/lib/rggen/core/core_extensions/forwardable_workaround.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26c927df65c347b1c8d450b7497933c8fe402b4850d08a5d61990179d4bc8211
|
4
|
+
data.tar.gz: 862fc6ba9a7671faabc58036139fd43c5bb2492662d3859ae809940ad5ae1b9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f047fa24d9e9ac529b2690a5953004f19661a82ce934062eaf609e48e165e9140bc5acb9a7b34a2add0ac040340250aa8c690bf8bc212ee93ce95e11b2c087c9
|
7
|
+
data.tar.gz: b78eb23efb2d6a1bc61acaa0d1160807e2c8938eb019472ec11e34d07c939a0b01b3dd00772515aff108409767ae737a5affc50b119eb2f149b040b60c046adc
|
@@ -4,8 +4,6 @@ module RgGen
|
|
4
4
|
module Core
|
5
5
|
module Base
|
6
6
|
class Component
|
7
|
-
include SingleForwardable
|
8
|
-
|
9
7
|
def initialize(*args)
|
10
8
|
@parent = args.first
|
11
9
|
@children = []
|
@@ -48,6 +46,20 @@ module RgGen
|
|
48
46
|
|
49
47
|
def post_initialize(*argv)
|
50
48
|
end
|
49
|
+
|
50
|
+
def define_proxy_calls(receiver, methods)
|
51
|
+
Array(methods)
|
52
|
+
.map(&:to_sym)
|
53
|
+
.each { |method| define_proxy_call(receiver, method) }
|
54
|
+
end
|
55
|
+
|
56
|
+
def define_proxy_call(receiver, method)
|
57
|
+
@proxy_calls ||= {}
|
58
|
+
@proxy_calls[method] = ProxyCall.new(receiver, method)
|
59
|
+
define_singleton_method(method) do |*args, &block|
|
60
|
+
@proxy_calls[__method__].call(*args, &block)
|
61
|
+
end
|
62
|
+
end
|
51
63
|
end
|
52
64
|
end
|
53
65
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RgGen
|
4
|
+
module Core
|
5
|
+
module Base
|
6
|
+
class ProxyCall
|
7
|
+
def initialize(receiver, method)
|
8
|
+
@receiver = receiver
|
9
|
+
@method = method
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(*args, &block)
|
13
|
+
@receiver.__send__(@method, *args, &block)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -6,7 +6,7 @@ module RgGen
|
|
6
6
|
class Component < Base::Component
|
7
7
|
def add_feature(feature)
|
8
8
|
super
|
9
|
-
|
9
|
+
define_proxy_calls(feature, feature.properties)
|
10
10
|
end
|
11
11
|
|
12
12
|
def properties
|
@@ -17,13 +17,6 @@ module RgGen
|
|
17
17
|
@features.each_value { |feature| feature.verify(scope) }
|
18
18
|
@children.each { |child| child.verify(scope) } if scope == :all
|
19
19
|
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def define_property_methods(feature)
|
24
|
-
target = "@features[:#{feature.feature_name}]"
|
25
|
-
def_delegators(target, *feature.properties)
|
26
|
-
end
|
27
20
|
end
|
28
21
|
end
|
29
22
|
end
|
@@ -74,9 +74,10 @@ module RgGen
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
def_delegator :'self.class', :properties
|
78
|
+
def_delegator :'self.class', :active_feature?
|
79
|
+
def_delegator :'self.class', :passive_feature?
|
80
|
+
def_delegator :'self.class', :ignore_empty_value?
|
80
81
|
|
81
82
|
def build(*args)
|
82
83
|
self.class.builders && do_build(args)
|
@@ -14,8 +14,8 @@ module RgGen
|
|
14
14
|
@source = source
|
15
15
|
@need_children = source.need_children?
|
16
16
|
define_hierarchical_accessors
|
17
|
-
define_property_accessors
|
18
17
|
define_children_presense_indicator
|
18
|
+
define_proxy_calls(@source, @source.properties)
|
19
19
|
end
|
20
20
|
|
21
21
|
def children?
|
@@ -47,10 +47,6 @@ module RgGen
|
|
47
47
|
|
48
48
|
private
|
49
49
|
|
50
|
-
def define_property_accessors
|
51
|
-
def_delegators(:@source, *@source.properties)
|
52
|
-
end
|
53
|
-
|
54
50
|
INDICATOR_NAMES = {
|
55
51
|
register_map: :register_blocks?,
|
56
52
|
register_block: :registers?,
|
@@ -69,9 +65,8 @@ module RgGen
|
|
69
65
|
end
|
70
66
|
|
71
67
|
def import_feature_methods(feature, scope)
|
72
|
-
receiver = "@features[:#{feature.feature_name}]"
|
73
68
|
methods = feature.exported_methods(scope)
|
74
|
-
|
69
|
+
define_proxy_calls(feature, methods)
|
75
70
|
end
|
76
71
|
|
77
72
|
def code_generators(kind, mode)
|
data/lib/rggen/core/version.rb
CHANGED
data/lib/rggen/core.rb
CHANGED
@@ -15,7 +15,6 @@ require_relative 'core/version'
|
|
15
15
|
require_relative 'core/facets'
|
16
16
|
require_relative 'core/core_extensions/casecmp'
|
17
17
|
require_relative 'core/core_extensions/object'
|
18
|
-
require_relative 'core/core_extensions/forwardable'
|
19
18
|
|
20
19
|
require_relative 'core/utility/attribute_setter'
|
21
20
|
require_relative 'core/utility/code_utility/line'
|
@@ -27,6 +26,7 @@ require_relative 'core/utility/regexp_patterns'
|
|
27
26
|
|
28
27
|
require_relative 'core/exceptions'
|
29
28
|
|
29
|
+
require_relative 'core/base/proxy_call'
|
30
30
|
require_relative 'core/base/internal_struct'
|
31
31
|
require_relative 'core/base/shared_context'
|
32
32
|
require_relative 'core/base/component'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rggen-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taichi Ishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docile
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/rggen/core/base/hierarchical_accessors.rb
|
87
87
|
- lib/rggen/core/base/hierarchical_feature_accessors.rb
|
88
88
|
- lib/rggen/core/base/internal_struct.rb
|
89
|
+
- lib/rggen/core/base/proxy_call.rb
|
89
90
|
- lib/rggen/core/base/shared_context.rb
|
90
91
|
- lib/rggen/core/builder.rb
|
91
92
|
- lib/rggen/core/builder/builder.rb
|
@@ -110,8 +111,6 @@ files:
|
|
110
111
|
- lib/rggen/core/configuration/ruby_loader.rb
|
111
112
|
- lib/rggen/core/configuration/yaml_loader.rb
|
112
113
|
- lib/rggen/core/core_extensions/casecmp.rb
|
113
|
-
- lib/rggen/core/core_extensions/forwardable.rb
|
114
|
-
- lib/rggen/core/core_extensions/forwardable_workaround.rb
|
115
114
|
- lib/rggen/core/core_extensions/object.rb
|
116
115
|
- lib/rggen/core/dsl.rb
|
117
116
|
- lib/rggen/core/exceptions.rb
|
@@ -185,5 +184,5 @@ requirements: []
|
|
185
184
|
rubygems_version: 3.0.3
|
186
185
|
signing_key:
|
187
186
|
specification_version: 4
|
188
|
-
summary: rggen-core-0.
|
187
|
+
summary: rggen-core-0.11.0
|
189
188
|
test_files: []
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Forwardable
|
4
|
-
def delegate_to_class(method_or_methods)
|
5
|
-
Array(method_or_methods)
|
6
|
-
.each { |m| def_instance_delegator(:'self.class', m) }
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
if ['2.3.1', '2.3.2', '2.3.3'].include?(RUBY_VERSION)
|
11
|
-
require_relative 'forwardable_workaround'
|
12
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SingleForwardable
|
4
|
-
# https://bugs.ruby-lang.org/issues/12478
|
5
|
-
def def_single_delegator(accessor, method, ali = method)
|
6
|
-
accessor = accessor.to_s
|
7
|
-
if method_defined?(accessor) || private_method_defined?(accessor)
|
8
|
-
accessor = "#{accessor}()"
|
9
|
-
end if self.class === Module
|
10
|
-
line_no = __LINE__; str = %{
|
11
|
-
def #{ali}(*args, &block)
|
12
|
-
begin
|
13
|
-
#{accessor}.__send__(:#{method}, *args, &block)
|
14
|
-
rescue ::Exception
|
15
|
-
$@.delete_if{|s| ::Forwardable::FILE_REGEXP =~ s} unless ::Forwardable::debug
|
16
|
-
::Kernel::raise
|
17
|
-
end
|
18
|
-
end
|
19
|
-
}
|
20
|
-
instance_eval(str, __FILE__, line_no)
|
21
|
-
end
|
22
|
-
end
|