evc_rails 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/evc_rails/template_handler.rb +79 -11
- data/lib/evc_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbedccd24baa2e896e5f5dc2f232b1a481ac3e5c9e82653f18d6d40d3b888f8d
|
4
|
+
data.tar.gz: 022e8e06c631aa3d6d52363377600a9b38870ffaa0506e1d5e732c0bf6859b73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0eca6627b253da66c7cc9d44730f0c7dff6306ae6040bae1ac08b294d59723f72d0a3ec2ffc67736de566b7e6567803e2f17c14590c17e0ec1952d96005309a
|
7
|
+
data.tar.gz: 0a1268f2b06d7027134d9277b2a48b1372e6483e6c8c08fdd0e2aed1b36f4bf81286edbce9b760a18435ff64f11f2e6fa06a5ba9008af22efe9f24e950daa104
|
@@ -283,17 +283,85 @@ module EvcRails
|
|
283
283
|
end.strip
|
284
284
|
|
285
285
|
params = []
|
286
|
-
attributes_str.
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
286
|
+
str = attributes_str.dup
|
287
|
+
until str.nil? || str.empty?
|
288
|
+
str = "" if str.nil?
|
289
|
+
str.lstrip!
|
290
|
+
str = "" if str.nil?
|
291
|
+
break if str.empty?
|
292
|
+
# Match key
|
293
|
+
break unless str =~ /\A(\w+)/
|
294
|
+
|
295
|
+
key = ::Regexp.last_match(1)
|
296
|
+
str = str[::Regexp.last_match(0).length..-1]
|
297
|
+
str = "" if str.nil?
|
298
|
+
str.lstrip!
|
299
|
+
str = "" if str.nil?
|
300
|
+
if str.start_with?("=")
|
301
|
+
str = str[1..-1]
|
302
|
+
str = "" if str.nil?
|
303
|
+
str.lstrip!
|
304
|
+
str = "" if str.nil?
|
305
|
+
if str.start_with?("{")
|
306
|
+
# Parse balanced curly braces
|
307
|
+
depth = 0
|
308
|
+
i = 0
|
309
|
+
found = false
|
310
|
+
while true
|
311
|
+
str = "" if str.nil?
|
312
|
+
break if str.empty? || i >= str.length
|
313
|
+
|
314
|
+
c = str[i]
|
315
|
+
if c == "{"
|
316
|
+
depth += 1
|
317
|
+
elsif c == "}"
|
318
|
+
depth -= 1
|
319
|
+
if depth == 0
|
320
|
+
found = true
|
321
|
+
break
|
322
|
+
end
|
323
|
+
end
|
324
|
+
i += 1
|
325
|
+
end
|
326
|
+
if found
|
327
|
+
ruby_expr = str[1...i] # skip opening '{', up to before closing '}'
|
328
|
+
str = str[(i + 1)..-1]
|
329
|
+
str = "" if str.nil?
|
330
|
+
params << "#{key}: #{ruby_expr}"
|
331
|
+
else
|
332
|
+
# Unbalanced braces, treat as error or fallback
|
333
|
+
params << "#{key}: true"
|
334
|
+
str = ""
|
335
|
+
end
|
336
|
+
elsif str.start_with?("\"")
|
337
|
+
# Double-quoted string
|
338
|
+
if str =~ /\A"([^"]*)"/
|
339
|
+
str = str[::Regexp.last_match(0).length..-1]
|
340
|
+
str = "" if str.nil?
|
341
|
+
params << "#{key}: \"#{::Regexp.last_match(1).gsub('"', '\\"')}\""
|
342
|
+
else
|
343
|
+
params << "#{key}: true"
|
344
|
+
str = ""
|
345
|
+
end
|
346
|
+
elsif str.start_with?("'")
|
347
|
+
# Single-quoted string
|
348
|
+
if str =~ /\A'([^']*)'/
|
349
|
+
str = str[::Regexp.last_match(0).length..-1]
|
350
|
+
str = "" if str.nil?
|
351
|
+
params << "#{key}: \"#{::Regexp.last_match(1).gsub("'", "\\'")}\""
|
352
|
+
else
|
353
|
+
params << "#{key}: true"
|
354
|
+
str = ""
|
355
|
+
end
|
356
|
+
else
|
357
|
+
# Unquoted value or malformed, treat as boolean true
|
358
|
+
params << "#{key}: true"
|
359
|
+
str = ""
|
360
|
+
end
|
361
|
+
else
|
362
|
+
# Standalone attribute (no value) - treat as boolean true
|
363
|
+
params << "#{key}: true"
|
364
|
+
end
|
297
365
|
end
|
298
366
|
[params, as_variable]
|
299
367
|
end
|
data/lib/evc_rails/version.rb
CHANGED