curlybars 1.10.0 → 1.12.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 +3 -1
- data/lib/curlybars.rb +1 -0
- metadata +3 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ee481734b28469381f2b97ae1bdfd7bea4f53fd2d8cebef0ca7cd1630bc61d2
|
4
|
+
data.tar.gz: 5444467d66e9991ebb7b43c8cbb71b4b066e3d5c032d5a7fe305a1bd7e9a8cfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7998d467492215867831a81d15f94b4b0748e02e007711e9772c2c632bfc40554d997e9b6762690ff39b04e7f6a56efcb2dee8ab2be88107f5e8e47735ddc09b
|
7
|
+
data.tar.gz: b647184f3f5466d4278193aa675295a27aca3f90cc3137a0782562192aed7ec2f7a00170f5479426e551e0571f7592ba16262ada7005e980881359d492624d45
|
@@ -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.12.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-07-10 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: actionpack
|
@@ -24,9 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '6.0'
|
27
|
-
- - "<"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '7.2'
|
30
27
|
type: :runtime
|
31
28
|
prerelease: false
|
32
29
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -34,9 +31,6 @@ dependencies:
|
|
34
31
|
- - ">="
|
35
32
|
- !ruby/object:Gem::Version
|
36
33
|
version: '6.0'
|
37
|
-
- - "<"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '7.2'
|
40
34
|
- !ruby/object:Gem::Dependency
|
41
35
|
name: activesupport
|
42
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,9 +38,6 @@ dependencies:
|
|
44
38
|
- - ">="
|
45
39
|
- !ruby/object:Gem::Version
|
46
40
|
version: '6.0'
|
47
|
-
- - "<"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '7.2'
|
50
41
|
type: :runtime
|
51
42
|
prerelease: false
|
52
43
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -54,9 +45,6 @@ dependencies:
|
|
54
45
|
- - ">="
|
55
46
|
- !ruby/object:Gem::Version
|
56
47
|
version: '6.0'
|
57
|
-
- - "<"
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: '7.2'
|
60
48
|
- !ruby/object:Gem::Dependency
|
61
49
|
name: ffi
|
62
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,9 +108,6 @@ dependencies:
|
|
120
108
|
- - ">="
|
121
109
|
- !ruby/object:Gem::Version
|
122
110
|
version: '6.0'
|
123
|
-
- - "<"
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '7.2'
|
126
111
|
type: :development
|
127
112
|
prerelease: false
|
128
113
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -130,9 +115,6 @@ dependencies:
|
|
130
115
|
- - ">="
|
131
116
|
- !ruby/object:Gem::Version
|
132
117
|
version: '6.0'
|
133
|
-
- - "<"
|
134
|
-
- !ruby/object:Gem::Version
|
135
|
-
version: '7.2'
|
136
118
|
- !ruby/object:Gem::Dependency
|
137
119
|
name: rake
|
138
120
|
requirement: !ruby/object:Gem::Requirement
|
@@ -287,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
269
|
- !ruby/object:Gem::Version
|
288
270
|
version: '0'
|
289
271
|
requirements: []
|
290
|
-
rubygems_version: 3.5.
|
272
|
+
rubygems_version: 3.5.11
|
291
273
|
signing_key:
|
292
274
|
specification_version: 4
|
293
275
|
summary: Create your views using Handlebars templates!
|