ejs-rcompiler 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/ejs-rcompiler.gemspec +1 -1
- data/lib/ejs/compiler.rb +1 -1
- data/spec/compiler_spec.rb +2 -2
- data/spec/fixtures/Cities.js +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -19,7 +19,7 @@ This will create a .js file with a JavaScript class name that matches the file n
|
|
19
19
|
== You can then require the output js file as such.
|
20
20
|
<script src="/javascripts/or.ui.Cities.js"></script>
|
21
21
|
<script>
|
22
|
-
document.body.innerHTML = or.ui.Cities.
|
22
|
+
document.body.innerHTML = or.ui.Cities.render({
|
23
23
|
cities: [{ name: "Paris" }, { name: "Mountain View" }, { name: "Las Vegas" }]
|
24
24
|
});
|
25
25
|
</script>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/ejs-rcompiler.gemspec
CHANGED
data/lib/ejs/compiler.rb
CHANGED
@@ -54,7 +54,7 @@ module Ejs
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def template_header(buffer, template_name)
|
57
|
-
buffer.push("#{template_name}.
|
57
|
+
buffer.push("#{template_name}.render = function(options) {")
|
58
58
|
buffer.push(" var p = [];")
|
59
59
|
buffer.push(" with(options) {")
|
60
60
|
end
|
data/spec/compiler_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe "Compiler" do
|
|
11
11
|
compiled = @compiler.js_source_from_string("TemplateName", "", true)
|
12
12
|
|
13
13
|
compiled[0].should == "window.TemplateName = window.TemplateName || {};"
|
14
|
-
compiled[1].should == "TemplateName.
|
14
|
+
compiled[1].should == "TemplateName.render = function(options) {"
|
15
15
|
compiled[2].should == " var p = [];"
|
16
16
|
compiled[3].should == " with(options) {"
|
17
17
|
|
@@ -25,7 +25,7 @@ describe "Compiler" do
|
|
25
25
|
compiled[0].should == "window.my = window.my || {};"
|
26
26
|
compiled[1].should == "window.my.namespace = window.my.namespace || {};"
|
27
27
|
compiled[2].should == "window.my.namespace.MyClass = window.my.namespace.MyClass || {};"
|
28
|
-
compiled[3].should == "my.namespace.MyClass.
|
28
|
+
compiled[3].should == "my.namespace.MyClass.render = function(options) {"
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should js_source_from_string static content" do
|
data/spec/fixtures/Cities.js
CHANGED