sandboxed_erb 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sandboxed_erb/tree_processor.rb +1 -1
- data/sandboxed_erb.gemspec +1 -1
- data/test/test_valid_templates.rb +18 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
@@ -152,7 +152,7 @@ module SandboxedErb
|
|
152
152
|
|
153
153
|
#allowed
|
154
154
|
|
155
|
-
[[:block, true],[:lasgn, true],[:arglist, true],[:str, true],[:dstr, true],[:evstr, true],[:lit, true],[:lvar, true],[:for, true], [:while, true], [:do, true], [:if, true], [:case, true], [:when, true], [:array, true], [:hash, true],[:iter, true]].each { |action, add_line_number|
|
155
|
+
[[:block, true],[:lasgn, true],[:arglist, true],[:str, true],[:dstr, true],[:evstr, true],[:lit, true],[:lvar, true],[:for, true], [:while, true], [:do, true], [:if, true], [:case, true], [:when, true], [:array, true], [:hash, true],[:iter, true],[:and, true],[:or, true]].each { |action, add_line_number|
|
156
156
|
if add_line_number
|
157
157
|
define_method "process_#{action}".intern do |tree|
|
158
158
|
puts tree.inspect if $DEBUG
|
data/sandboxed_erb.gemspec
CHANGED
@@ -57,6 +57,24 @@ class TestValidTemplates < Test::Unit::TestCase
|
|
57
57
|
assert_equal "2", result
|
58
58
|
end
|
59
59
|
|
60
|
+
should "allow extended conditions" do
|
61
|
+
str_template = "<%
|
62
|
+
i=5
|
63
|
+
if i > 10 && i < 300 %>1<%elsif i > 100 || i == 5%>2<%end%>"
|
64
|
+
|
65
|
+
template = SandboxedErb::Template.new
|
66
|
+
result = template.compile(str_template)
|
67
|
+
|
68
|
+
assert_equal nil, template.get_error
|
69
|
+
|
70
|
+
assert_equal true, result
|
71
|
+
|
72
|
+
result = template.run(nil,{})
|
73
|
+
|
74
|
+
assert_equal nil, template.get_error
|
75
|
+
assert_equal "2", result
|
76
|
+
end
|
77
|
+
|
60
78
|
should "allow unless statement" do
|
61
79
|
str_template = "<%
|
62
80
|
i=0
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sandboxed_erb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 2
|
10
|
+
version: 0.4.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- MarkPent
|