mschuerig-ruby_template_handler 0.0.1 → 0.0.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/lib/ruby_template_handler.rb +4 -4
- data/test/test_ruby_template_handler.rb +2 -2
- metadata +2 -2
@@ -2,14 +2,14 @@
|
|
2
2
|
require 'action_view'
|
3
3
|
|
4
4
|
class RubyTemplateHandler < ActionView::TemplateHandler
|
5
|
-
VERSION = '0.0.
|
5
|
+
VERSION = '0.0.2'
|
6
6
|
include ActionView::TemplateHandlers::Compilable
|
7
7
|
|
8
8
|
def compile(template)
|
9
|
-
src =
|
9
|
+
src = template.source
|
10
10
|
unless File.basename(template.filename).starts_with?('_')
|
11
|
-
src
|
11
|
+
src = 'ActiveSupport::JSON.encode(' + src + ')'
|
12
12
|
end
|
13
|
-
src
|
13
|
+
'self.output_buffer = (' + src + ')'
|
14
14
|
end
|
15
15
|
end
|
@@ -61,8 +61,8 @@ TMPL
|
|
61
61
|
def test_render_template
|
62
62
|
result = @template.render(@view)
|
63
63
|
assert_kind_of String, result
|
64
|
-
assert_match
|
65
|
-
assert_match
|
64
|
+
assert_match(/"identifier": "id"/, result)
|
65
|
+
assert_match(/"totalCount": 1/, result)
|
66
66
|
end
|
67
67
|
|
68
68
|
def test_render_partial
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mschuerig-ruby_template_handler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Schuerig
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-26 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|