ice 0.4.1 → 0.4.2
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.
- data/Gemfile +1 -1
- data/lib/ice/eco_template/base.rb +3 -1
- data/lib/ice/eco_template/handler.rb +7 -7
- metadata +3 -3
data/Gemfile
CHANGED
@@ -6,6 +6,7 @@ module Ice
|
|
6
6
|
module EcoTemplate
|
7
7
|
|
8
8
|
def self.convert_template(template_text, vars = {})
|
9
|
+
V8::C::Locker() do
|
9
10
|
context = V8::Context.new
|
10
11
|
context.eval(open "#{File.dirname(__FILE__)}/../../../js/lib/path-helper.js")
|
11
12
|
|
@@ -21,6 +22,7 @@ module Ice
|
|
21
22
|
template = context["eco"]["compile"].call(template_text)
|
22
23
|
|
23
24
|
template.call(vars.to_ice)
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
|
-
end
|
28
|
+
end
|
@@ -3,26 +3,26 @@ require "ice/eco_template/base"
|
|
3
3
|
module Ice
|
4
4
|
module EcoTemplate
|
5
5
|
class Handler < ActionView::Template::Handler
|
6
|
-
|
7
|
-
include ActionView::Template::Handlers::Compilable
|
8
|
-
|
9
|
-
self.default_format = :eco
|
10
|
-
|
11
|
-
def compile(template)
|
6
|
+
def self.call(template)
|
12
7
|
<<-ECO
|
8
|
+
|
13
9
|
template_source = <<-ECO_TEMPLATE
|
14
10
|
#{template.source}
|
15
11
|
ECO_TEMPLATE
|
16
|
-
|
12
|
+
|
17
13
|
variable_names = controller.instance_variable_names
|
18
14
|
variable_names -= %w[@template]
|
19
15
|
if controller.respond_to?(:protected_instance_variables)
|
20
16
|
variable_names -= controller.protected_instance_variables
|
21
17
|
end
|
18
|
+
|
19
|
+
variables = {}
|
22
20
|
variable_names.each do |name|
|
23
21
|
variables[name.sub(/^@/, "")] = controller.instance_variable_get(name)
|
24
22
|
end
|
23
|
+
|
25
24
|
Ice::EcoTemplate.convert_template(template_source, variables.merge(local_assigns))
|
25
|
+
|
26
26
|
ECO
|
27
27
|
end
|
28
28
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.
|
5
|
+
version: 0.4.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Nate Kidwell
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2011-06-27 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.9.1
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id002
|
38
38
|
description: User templates written in javascript
|