curlybars 1.10.0 → 1.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/curlybars/method_whitelist.rb +11 -0
- data/lib/curlybars/node/block_helper_else.rb +12 -0
- data/lib/curlybars/version.rb +1 -1
- data/lib/curlybars.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75e0f6f2934a512ad3ba98455f3eab1492ddd131489322d4082a19cf9568b1cc
|
4
|
+
data.tar.gz: 9e36b98d7c878e4083ca27f34a7daccc2eee4f39bb6e4e5040c186a806321f87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aeb6a8ace0d10637dcc0a9be64fc23e150d1971afb01d4ce8c735d9740e6a1f1644c33cd662dbd3fbbaa9e2b8b34a2c76aa735d064eb08118dd54435c3eb5c9
|
7
|
+
data.tar.gz: fd1289f763c7870e921120b849a1f1fa8de334c9998e8ca34fc4758384a83fc62ac86070b382b934f47961a4f0b7073c49ade00ebb77572b0d419d7e8a5d8677
|
@@ -100,6 +100,17 @@ module Curlybars
|
|
100
100
|
define_method(:allows_method?) do |method|
|
101
101
|
allowed_methods.include?(method)
|
102
102
|
end
|
103
|
+
|
104
|
+
define_method(:as_json) do |*args|
|
105
|
+
return @__as_json if defined?(@__as_json)
|
106
|
+
|
107
|
+
@__as_json ||= allowed_methods.each_with_object({}) do |method, hash|
|
108
|
+
unless self.method(method).arity > 0
|
109
|
+
value = send(method)
|
110
|
+
hash[method] = value.equal?(self) ? "[circular reference]" : value.as_json
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
103
114
|
end
|
104
115
|
|
105
116
|
def self.extended(base)
|
@@ -79,6 +79,18 @@ module Curlybars
|
|
79
79
|
arguments.map { |argument| argument.validate_as_value(branches) },
|
80
80
|
options.map { |option| option.validate(branches) }
|
81
81
|
]
|
82
|
+
elsif helper.generic_helper?(branches)
|
83
|
+
if arguments.empty?
|
84
|
+
message = "#{helper.path} requires an argument"
|
85
|
+
Curlybars::Error::Validate.new('invalid_signature', message, helper.position)
|
86
|
+
else
|
87
|
+
[
|
88
|
+
helper_template.validate(branches),
|
89
|
+
else_template.validate(branches),
|
90
|
+
arguments.map { |argument| argument.validate(branches, check_type: :anything) },
|
91
|
+
options.map { |option| option.validate(branches) }
|
92
|
+
]
|
93
|
+
end
|
82
94
|
else
|
83
95
|
message = "#{helper.path} must be allowed as helper or leaf"
|
84
96
|
Curlybars::Error::Validate.new('invalid_block_helper', message, helper.position)
|
data/lib/curlybars/version.rb
CHANGED
data/lib/curlybars.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curlybars
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Libo Cannici
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2024-
|
18
|
+
date: 2024-02-27 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: actionpack
|