bridgetown-builder 1.0.0.alpha7 → 1.0.0.alpha8

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: cbe353b4c0d8d4b7777c00132529c1666c75e265fad46ac95ae656b1b9eb99c2
4
- data.tar.gz: 15ffffb1c35938d6104925d06507982de473e879e25575f7846348f0713ea0bd
3
+ metadata.gz: f0af9a4478f4060d0a7857ebd9cc1a5af44d2c76a1d66fa1395128526e0c4ec7
4
+ data.tar.gz: 1028fb0f08360d97ac4bc936f586e657aca87a45e488dea41e716865cefb3721
5
5
  SHA512:
6
- metadata.gz: 274b7e14da077be9b652e2f080bf939e34bcf0a72d759d9405d80ae0d67fe28b9b4eacd4088b5297945345a8701b3779d48394920edc94deef13ba7c70d0dcf4
7
- data.tar.gz: 8296330ca5e566c76ec7fb62e0301d00aad8ad91d634481cda9a4f1952177dfaeae694abe540350a5ad0509be65592c40d4cc96406c893e4d76e7ca99f759638
6
+ metadata.gz: 32568bfe3a6d2e713711354667d4e0efa938dd1e95a3c5821d017db9ca2a8352c1d263be4920ae52cd94a8cce200f3cf6c1cde45080d63094f84f2d7f593010b
7
+ data.tar.gz: b02d3c933c8b850af9fff8bd29728657d5d826c00e1b279b84827b033b93cd0aebbb8e4726bc7768e09b9ac39e27d1352ec959d33dac001d54601f4c25a3b8f1
@@ -8,13 +8,19 @@ module Bridgetown
8
8
  builder_self = self
9
9
  m = Module.new
10
10
 
11
- if block && !helpers_scope
12
- m.define_method helper_name do |*args|
13
- builder_self.instance_exec(*args, &block)
14
- end
15
- else
16
- block = method(method_name) if method_name
11
+ if block && helpers_scope
17
12
  m.define_method helper_name, &block
13
+ else
14
+ method_name ||= helper_name unless block
15
+ unless method_name
16
+ method_name = :"__helper_#{helper_name}"
17
+ builder_self.define_singleton_method(method_name) do |*args, **kwargs, &block2|
18
+ block.(*args, **kwargs, &block2)
19
+ end
20
+ end
21
+ m.define_method helper_name do |*args, **kwargs, &block2|
22
+ builder_self.send(method_name, *args, **kwargs, &block2)
23
+ end
18
24
  end
19
25
 
20
26
  Bridgetown::RubyTemplateView::Helpers.include(m)
@@ -8,13 +8,19 @@ module Bridgetown
8
8
  builder_self = self
9
9
  m = Module.new
10
10
 
11
- if block && !filters_scope
12
- m.define_method filter_name do |*args|
13
- builder_self.instance_exec(*args, &block)
14
- end
15
- else
16
- block = method(method_name) if method_name
11
+ if block && filters_scope
17
12
  m.define_method filter_name, &block
13
+ else
14
+ method_name ||= filter_name unless block
15
+ unless method_name
16
+ method_name = :"__filter_#{filter_name}"
17
+ builder_self.define_singleton_method(method_name) do |*args, **kwargs|
18
+ block.(*args, **kwargs) # rubocop:disable Performance/RedundantBlockCall
19
+ end
20
+ end
21
+ m.define_method filter_name do |*args, **kwargs|
22
+ builder_self.send(method_name, *args, **kwargs)
23
+ end
18
24
  end
19
25
 
20
26
  ::Liquid::Template.register_filter(m)
@@ -23,7 +29,8 @@ module Bridgetown
23
29
  end
24
30
 
25
31
  def liquid_tag(tag_name, method_name = nil, as_block: false, &block)
26
- block = method(method_name) if method_name.is_a?(Symbol)
32
+ method_name ||= tag_name unless block
33
+ block = method(method_name) if method_name
27
34
  local_name = name # pull the name method into a local variable
28
35
 
29
36
  tag_class = as_block ? ::Liquid::Block : ::Liquid::Tag
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha7
4
+ version: 1.0.0.alpha8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0.alpha7
19
+ version: 1.0.0.alpha8
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.0.alpha7
26
+ version: 1.0.0.alpha8
27
27
  description:
28
28
  email: maintainers@bridgetownrb.com
29
29
  executables: []