rggen-core 0.11.0 → 0.12.0

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: 26c927df65c347b1c8d450b7497933c8fe402b4850d08a5d61990179d4bc8211
4
- data.tar.gz: 862fc6ba9a7671faabc58036139fd43c5bb2492662d3859ae809940ad5ae1b9b
3
+ metadata.gz: f8dee87d7320d747018f9f7b739024fe776cb30ad25fd8d64c89c24d5e4bbaf2
4
+ data.tar.gz: 1c78c53f111dd3cf10dda3ad836933a9044730d0ae1cd6a2436dd0ea92733770
5
5
  SHA512:
6
- metadata.gz: f047fa24d9e9ac529b2690a5953004f19661a82ce934062eaf609e48e165e9140bc5acb9a7b34a2add0ac040340250aa8c690bf8bc212ee93ce95e11b2c087c9
7
- data.tar.gz: b78eb23efb2d6a1bc61acaa0d1160807e2c8938eb019472ec11e34d07c939a0b01b3dd00772515aff108409767ae737a5affc50b119eb2f149b040b60c046adc
6
+ metadata.gz: 784f1269c603f6c1bed63aa25c1a2030414cf685fde796494cd4c6b00a976b6b46f90c118589644fe5eb1df6ecd21db6ceef81c63f6c35900b85543ca617c949
7
+ data.tar.gz: e74c890fea65661e48d640df7bc6f8827ca0668d5f0aafaf7a4e77615e8cf2a8bae9a742d9e25490f73513c1d2a6a21cb831d455fac58cad758bf7ddce1a6f92
@@ -19,6 +19,8 @@ module RgGen
19
19
  attr_reader :feature_name
20
20
 
21
21
  class << self
22
+ attr_reader :printables
23
+
22
24
  private
23
25
 
24
26
  def define_helpers(&body)
@@ -10,12 +10,16 @@ module RgGen
10
10
  end
11
11
 
12
12
  def properties
13
- @features.each_value.flat_map(&:properties)
13
+ features.flat_map(&:properties)
14
14
  end
15
15
 
16
16
  def verify(scope)
17
- @features.each_value { |feature| feature.verify(scope) }
18
- @children.each { |child| child.verify(scope) } if scope == :all
17
+ features.each { |feature| feature.verify(scope) }
18
+ children.each { |child| child.verify(scope) } if scope == :all
19
+ end
20
+
21
+ def printables
22
+ features.select(&:printable?).flat_map(&:printables).to_h
19
23
  end
20
24
  end
21
25
  end
@@ -56,12 +56,20 @@ module RgGen
56
56
 
57
57
  attr_reader :verifiers
58
58
 
59
+ def printable(name, &body)
60
+ @printables ||= {}
61
+ @printables[name] = body
62
+ end
63
+
64
+ attr_reader :printables
65
+
59
66
  def inherited(subclass)
60
67
  super
61
68
  export_instance_variable(:@properties, subclass, &:dup)
62
69
  export_instance_variable(:@ignore_empty_value, subclass)
63
70
  export_instance_variable(:@builders, subclass, &:dup)
64
71
  export_instance_variable(:@input_matcher, subclass)
72
+ export_instance_variable(:@printables, subclass, &:dup)
65
73
  export_verifiers(subclass) if @verifiers
66
74
  end
67
75
 
@@ -87,6 +95,16 @@ module RgGen
87
95
  verified?(scope) || do_verify(scope)
88
96
  end
89
97
 
98
+ def printables
99
+ helper
100
+ .printables
101
+ &.map { |name, body| [name, printable(name, body)] }
102
+ end
103
+
104
+ def printable?
105
+ !helper.printables.nil?
106
+ end
107
+
90
108
  private
91
109
 
92
110
  def do_build(args)
@@ -125,6 +143,10 @@ module RgGen
125
143
  .each { |verifier| verifier.verify(self) }
126
144
  (@verified ||= {})[scope] = true
127
145
  end
146
+
147
+ def printable(name, body)
148
+ body ? instance_exec(&body) : __send__(name)
149
+ end
128
150
  end
129
151
  end
130
152
  end
@@ -27,6 +27,10 @@ module RgGen
27
27
  import_feature_methods(feature, :class)
28
28
  end
29
29
 
30
+ def printables
31
+ @source.printables
32
+ end
33
+
30
34
  def pre_build
31
35
  @features.each_value(&:pre_build)
32
36
  end
@@ -72,6 +72,7 @@ module RgGen
72
72
 
73
73
  class << self
74
74
  def inherited(subclass)
75
+ super
75
76
  export_instance_variable(:@pre_builders, subclass, &:dup)
76
77
  export_instance_variable(:@builders, subclass, &:dup)
77
78
  export_instance_variable(:@template_engine, subclass)
@@ -3,7 +3,7 @@
3
3
  module RgGen
4
4
  module Core
5
5
  MAJOR = 0
6
- MINOR = 11
6
+ MINOR = 12
7
7
  PATCH = 0
8
8
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
9
9
  end
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.11.0
4
+ version: 0.12.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-08-11 00:00:00.000000000 Z
11
+ date: 2019-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docile
@@ -184,5 +184,5 @@ requirements: []
184
184
  rubygems_version: 3.0.3
185
185
  signing_key:
186
186
  specification_version: 4
187
- summary: rggen-core-0.11.0
187
+ summary: rggen-core-0.12.0
188
188
  test_files: []