curlybars 1.9.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/rendering_support.rb +2 -1
- data/lib/curlybars/template_handler.rb +0 -4
- data/lib/curlybars/version.rb +1 -1
- data/lib/curlybars.rb +1 -0
- metadata +21 -21
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)
|
@@ -43,10 +43,6 @@ module Curlybars
|
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
|
-
def compile_for_actionview5(template)
|
47
|
-
compile(template, template.source)
|
48
|
-
end
|
49
|
-
|
50
46
|
def compile(template, source)
|
51
47
|
# Template is empty, so there's no need to initialize a presenter.
|
52
48
|
return %("") if source.empty?
|
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:
|
18
|
+
date: 2024-02-27 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: actionpack
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
version: '6.0'
|
27
27
|
- - "<"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '7.
|
29
|
+
version: '7.2'
|
30
30
|
type: :runtime
|
31
31
|
prerelease: false
|
32
32
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
version: '6.0'
|
37
37
|
- - "<"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '7.
|
39
|
+
version: '7.2'
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: activesupport
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
version: '6.0'
|
47
47
|
- - "<"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '7.
|
49
|
+
version: '7.2'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version: '6.0'
|
57
57
|
- - "<"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '7.
|
59
|
+
version: '7.2'
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: ffi
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
version: '6.0'
|
123
123
|
- - "<"
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: '7.
|
125
|
+
version: '7.2'
|
126
126
|
type: :development
|
127
127
|
prerelease: false
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -132,7 +132,7 @@ dependencies:
|
|
132
132
|
version: '6.0'
|
133
133
|
- - "<"
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version: '7.
|
135
|
+
version: '7.2'
|
136
136
|
- !ruby/object:Gem::Dependency
|
137
137
|
name: rake
|
138
138
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,72 +151,72 @@ dependencies:
|
|
151
151
|
name: rspec-rails
|
152
152
|
requirement: !ruby/object:Gem::Requirement
|
153
153
|
requirements:
|
154
|
-
- - "
|
154
|
+
- - ">="
|
155
155
|
- !ruby/object:Gem::Version
|
156
|
-
version: '
|
156
|
+
version: '0'
|
157
157
|
type: :development
|
158
158
|
prerelease: false
|
159
159
|
version_requirements: !ruby/object:Gem::Requirement
|
160
160
|
requirements:
|
161
|
-
- - "
|
161
|
+
- - ">="
|
162
162
|
- !ruby/object:Gem::Version
|
163
|
-
version: '
|
163
|
+
version: '0'
|
164
164
|
- !ruby/object:Gem::Dependency
|
165
165
|
name: rubocop
|
166
166
|
requirement: !ruby/object:Gem::Requirement
|
167
167
|
requirements:
|
168
168
|
- - "~>"
|
169
169
|
- !ruby/object:Gem::Version
|
170
|
-
version: 1.
|
170
|
+
version: '1.57'
|
171
171
|
type: :development
|
172
172
|
prerelease: false
|
173
173
|
version_requirements: !ruby/object:Gem::Requirement
|
174
174
|
requirements:
|
175
175
|
- - "~>"
|
176
176
|
- !ruby/object:Gem::Version
|
177
|
-
version: 1.
|
177
|
+
version: '1.57'
|
178
178
|
- !ruby/object:Gem::Dependency
|
179
179
|
name: rubocop-performance
|
180
180
|
requirement: !ruby/object:Gem::Requirement
|
181
181
|
requirements:
|
182
182
|
- - "~>"
|
183
183
|
- !ruby/object:Gem::Version
|
184
|
-
version: 1.
|
184
|
+
version: '1.19'
|
185
185
|
type: :development
|
186
186
|
prerelease: false
|
187
187
|
version_requirements: !ruby/object:Gem::Requirement
|
188
188
|
requirements:
|
189
189
|
- - "~>"
|
190
190
|
- !ruby/object:Gem::Version
|
191
|
-
version: 1.
|
191
|
+
version: '1.19'
|
192
192
|
- !ruby/object:Gem::Dependency
|
193
193
|
name: rubocop-rake
|
194
194
|
requirement: !ruby/object:Gem::Requirement
|
195
195
|
requirements:
|
196
196
|
- - "~>"
|
197
197
|
- !ruby/object:Gem::Version
|
198
|
-
version: 0.
|
198
|
+
version: '0.6'
|
199
199
|
type: :development
|
200
200
|
prerelease: false
|
201
201
|
version_requirements: !ruby/object:Gem::Requirement
|
202
202
|
requirements:
|
203
203
|
- - "~>"
|
204
204
|
- !ruby/object:Gem::Version
|
205
|
-
version: 0.
|
205
|
+
version: '0.6'
|
206
206
|
- !ruby/object:Gem::Dependency
|
207
207
|
name: rubocop-rspec
|
208
208
|
requirement: !ruby/object:Gem::Requirement
|
209
209
|
requirements:
|
210
210
|
- - "~>"
|
211
211
|
- !ruby/object:Gem::Version
|
212
|
-
version: 2.
|
212
|
+
version: '2.25'
|
213
213
|
type: :development
|
214
214
|
prerelease: false
|
215
215
|
version_requirements: !ruby/object:Gem::Requirement
|
216
216
|
requirements:
|
217
217
|
- - "~>"
|
218
218
|
- !ruby/object:Gem::Version
|
219
|
-
version: 2.
|
219
|
+
version: '2.25'
|
220
220
|
description: |-
|
221
221
|
A view layer for your Rails apps that separates structure and logic, using Handlebars templates.
|
222
222
|
Strongly inspired by Curly Template gem by Daniel Schierbeck.
|
@@ -287,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
287
|
- !ruby/object:Gem::Version
|
288
288
|
version: '0'
|
289
289
|
requirements: []
|
290
|
-
rubygems_version: 3.
|
290
|
+
rubygems_version: 3.5.3
|
291
291
|
signing_key:
|
292
292
|
specification_version: 4
|
293
293
|
summary: Create your views using Handlebars templates!
|