config_templates 1.1.4 → 1.1.5

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
  SHA1:
3
- metadata.gz: ed2ef886ddd1d008ef5eac84a4ff9f09dbb8bbad
4
- data.tar.gz: 575336494ebd01c60efcf01c8bcdae3de8943767
3
+ metadata.gz: 9f30c2c11c2f2d4cdd040d9c5e5c235050c76dba
4
+ data.tar.gz: 658e799d25032fbdca3d667f61edb05a487c7261
5
5
  SHA512:
6
- metadata.gz: b866e4680f05c4cd026d323637bf63b05d752f5250be05a2b56177a8408a07c97495685fbfb9e31c1fee27147b3640f20ab7c9303b422e214311462d39d253ef
7
- data.tar.gz: 77c7a6a8cc40ed17bbbed10c67addb738be7300b64545c004f466eb5155d687e5568fb9974dc47e6e557b1c5311f3dc8bc350d824871f0313aa73843a452b1ed
6
+ metadata.gz: 881bc15e1e5f209b45c7388eeb20d49a718806372e480f052a16f85a28e8827eb295334b8f6901c691164843bcaea7974c0544c49cf287f71e261369e599ccf9
7
+ data.tar.gz: a6c61bd1fc3d14932c1b7c9dff390f3d749559dbebc13dc0687216997499f62a0fa90b6ab71c9d7a721aa27080a6dc5f4ff87969480c0fbdf63e733f36cc8d9e
@@ -2,8 +2,8 @@ module ConfigTemplates::Collections
2
2
  class Extensions
3
3
  def initialize
4
4
  @extensions = {
5
- /^.+\?$/ => ::ConfigTemplates::Extensions::Stage,
6
- 'include' => ::ConfigTemplates::Extensions::Include
5
+ /^.+\?$/ => proc { |*args| ::ConfigTemplates::Extensions::Stage.new.call *args },
6
+ 'include' => proc { |*args| ::ConfigTemplates::Extensions::Include.new.call *args }
7
7
  }
8
8
  end
9
9
 
@@ -18,18 +18,22 @@ module ConfigTemplates::Contexts
18
18
  end
19
19
 
20
20
  def components
21
- ::ConfigTemplates::Collections::Components.new(@criteria).tap do |collection|
22
- @templates.find_all.each do |template|
23
- context = ::ConfigTemplates::Contexts::Rendering.new
24
- context.components = collection
25
- collection << component(template, collection, context)
26
- end
27
- end
21
+ collection = ::ConfigTemplates::Collections::Components.new @criteria
22
+ add_components_to collection
23
+ collection
28
24
  end
29
25
 
30
26
  private
31
27
 
32
- def component(template, components, context)
28
+ def add_components_to(collection)
29
+ @templates.find_all.each do |template|
30
+ context = ::ConfigTemplates::Contexts::Rendering.new
31
+ context.components = collection
32
+ collection << component(template, context)
33
+ end
34
+ end
35
+
36
+ def component(template, context)
33
37
  validator = @validators.find_by_file_name template.source_path
34
38
  engine = @engines.find_by_extension template.extension
35
39
  component = ::ConfigTemplates::Models::Component.new(template, context, validator, engine)
@@ -29,9 +29,9 @@ module ConfigTemplates::Contexts
29
29
  end
30
30
 
31
31
  def method_missing(method_name, *args, &block)
32
- extension_class = @extensions.find_by_name(method_name) || super
32
+ extension = @extensions.find_by_name(method_name) || super
33
33
  invocation = ::ConfigTemplates::Extensions::Invocation.new method_name, args, block
34
- extension_class.new.call(self, invocation)
34
+ extension.call self, invocation
35
35
  end
36
36
 
37
37
  def respond_to_missing?(method_name)
@@ -1,12 +1,12 @@
1
1
  module ConfigTemplates::Extensions
2
2
  class Include
3
3
  def call(context, invocation)
4
- child_component = context.components.find_by_path!(
4
+ component = context.components.find_by_path!(
5
5
  invocation.args.first,
6
6
  context.component.source_path
7
7
  )
8
- child_component.child!
9
- child_component.render
8
+ component.child!
9
+ component.render
10
10
  end
11
11
  end
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module ConfigTemplates
2
- VERSION = '1.1.4'.freeze
2
+ VERSION = '1.1.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - g.ivanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-06 00:00:00.000000000 Z
11
+ date: 2018-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler