bridgetown-builder 1.0.0.alpha5 → 1.0.0.alpha9

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: 480dce3843c12ad944e313aa1d31fadc4a4b91d7aaac47e408fd2627b9da09ab
4
- data.tar.gz: e9d7a6a7878df212b3e3a96cced65f19e17649cd8f6faf29ede57739c9059627
3
+ metadata.gz: 5d1f6d1ad7128f8ac9cfffaa68eead1fdf1378b0612b17418db963c895bcd0a7
4
+ data.tar.gz: 2edb21a82e52e35e33f729a356bd25fa09b41d82cf85d3dd2138db269e276c18
5
5
  SHA512:
6
- metadata.gz: f958566d2b63616e9db00315a97657b107b00d8bc2fac7c19a21f47efb72bb59299f1ce90210239fb0f5c944c56b0e1ff0ab15e6f765c736f23d1084ff7fd47e
7
- data.tar.gz: c88214e34b9c7ddb0a2b43a36ee5d7d79843f813d934e0b713827781c3551f2cca0e5171c6054ec97edada9e0baff9f847832b06c6e4d12c3bf7ab6e7d130d1d
6
+ metadata.gz: ec5ceb02c59c8792f01e791200f5dbb6b87eb1b4a7fad65bb7a6e6ebca4e13355006ac82da2bd22e5e517e5fd96e942673dd4c3c6dc0d5a9c84e7d08c03d1834
7
+ data.tar.gz: 0ac5f55e8da552341b7e05555a57f90730142523190d5b8c4e02d60421feb89d05eeee581bbfe006fdcc91c0722a0aa2c12cd0b666d5e0eef54018ec4d7a6c04
@@ -15,16 +15,16 @@ module Bridgetown
15
15
  end
16
16
  end
17
17
 
18
- ruby2_keywords def before_build(*args, &block)
19
- set_callback :build, :before, *args, &block
18
+ def before_build(*args, **kwargs, &block)
19
+ set_callback :build, :before, *args, **kwargs, &block
20
20
  end
21
21
 
22
- ruby2_keywords def after_build(*args, &block)
23
- set_callback :build, :after, *args, &block
22
+ def after_build(*args, **kwargs, &block)
23
+ set_callback :build, :after, *args, **kwargs, &block
24
24
  end
25
25
 
26
- ruby2_keywords def around_build(*args, &block)
27
- set_callback :build, :around, *args, &block
26
+ def around_build(*args, **kwargs, &block)
27
+ set_callback :build, :around, *args, **kwargs, &block
28
28
  end
29
29
  end
30
30
 
@@ -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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha5
4
+ version: 1.0.0.alpha9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-22 00:00:00.000000000 Z
11
+ date: 2021-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bridgetown-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0.alpha5
19
+ version: 1.0.0.alpha9
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.alpha5
26
+ version: 1.0.0.alpha9
27
27
  description:
28
28
  email: maintainers@bridgetownrb.com
29
29
  executables: []