mustache 0.5.0 → 0.6.0

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.
Files changed (52) hide show
  1. data/README.md +30 -179
  2. data/Rakefile +87 -46
  3. data/bin/mustache +10 -19
  4. data/lib/mustache/context.rb +55 -12
  5. data/lib/mustache/sinatra.rb +1 -1
  6. data/lib/mustache/template.rb +3 -15
  7. data/lib/mustache/version.rb +1 -1
  8. data/man/mustache.1 +138 -0
  9. data/man/mustache.1.html +168 -0
  10. data/man/mustache.1.ron +94 -0
  11. data/man/mustache.5 +364 -0
  12. data/man/mustache.5.html +300 -0
  13. data/man/mustache.5.ron +220 -0
  14. data/test/helper.rb +1 -0
  15. data/test/mustache_test.rb +25 -16
  16. metadata +32 -65
  17. data/.gitignore +0 -1
  18. data/.kick +0 -26
  19. data/CONTRIBUTORS +0 -6
  20. data/HISTORY.md +0 -70
  21. data/benchmarks/complex.erb +0 -15
  22. data/benchmarks/complex.haml +0 -10
  23. data/benchmarks/helper.rb +0 -20
  24. data/benchmarks/simple.erb +0 -5
  25. data/benchmarks/speed.rb +0 -76
  26. data/contrib/mustache.vim +0 -69
  27. data/contrib/tpl-mode.el +0 -274
  28. data/examples/comments.mustache +0 -1
  29. data/examples/comments.rb +0 -14
  30. data/examples/complex_view.mustache +0 -16
  31. data/examples/complex_view.rb +0 -34
  32. data/examples/delimiters.mustache +0 -6
  33. data/examples/delimiters.rb +0 -22
  34. data/examples/double_section.mustache +0 -7
  35. data/examples/double_section.rb +0 -14
  36. data/examples/escaped.mustache +0 -1
  37. data/examples/escaped.rb +0 -14
  38. data/examples/inner_partial.mustache +0 -1
  39. data/examples/inner_partial.txt +0 -1
  40. data/examples/namespaced.mustache +0 -1
  41. data/examples/namespaced.rb +0 -25
  42. data/examples/partial_with_module.mustache +0 -3
  43. data/examples/partial_with_module.rb +0 -37
  44. data/examples/passenger.conf +0 -5
  45. data/examples/passenger.rb +0 -27
  46. data/examples/simple.mustache +0 -5
  47. data/examples/simple.rb +0 -26
  48. data/examples/template_partial.mustache +0 -2
  49. data/examples/template_partial.rb +0 -18
  50. data/examples/template_partial.txt +0 -4
  51. data/examples/unescaped.mustache +0 -1
  52. data/examples/unescaped.rb +0 -14
@@ -0,0 +1,220 @@
1
+ mustache(5) -- Logic-less templates.
2
+ ====================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ A typical Mustache template:
7
+
8
+ Hello {{name}}
9
+ You have just won ${{value}}!
10
+ {{#in_ca}}
11
+ Well, ${{taxed_value}}, after taxes.
12
+ {{/in_ca}}
13
+
14
+ Given the following hash:
15
+
16
+ {
17
+ "name": "Chris",
18
+ "value": 10000,
19
+ "taxed_value": 10000 - (10000 * 0.4),
20
+ "in_ca": true
21
+ }
22
+
23
+ Will produce the following:
24
+
25
+ Hello Chris
26
+ You have just won $10000!
27
+ Well, $6000.0, after taxes.
28
+
29
+
30
+ ## DESCRIPTION
31
+
32
+ Mustache can be used for HTML, config files, source code -
33
+ anything. It works by expanding tags in a template using values
34
+ provided in a hash or object.
35
+
36
+ We call it "logic-less" because there are no if statements, else
37
+ clauses, or for loops. Instead there are only tags. Some tags are
38
+ replaced with a value, some nothing, and others a series of
39
+ values. This document explains the different types of Mustache tags.
40
+
41
+
42
+ ## TAG TYPES
43
+
44
+ Tags are indicated by the double mustaches. `{{name}}` is a tag. Let's
45
+ talk about the different types of tags.
46
+
47
+
48
+ ### Variables
49
+
50
+ The most basic tag is the variable. A `{{name}}` tag in a basic
51
+ template will try to call the `name` method on your view. If there is
52
+ no `name` method, an exception will be raised.
53
+
54
+ All variables are HTML escaped by default. If you want to return
55
+ unescaped HTML, use the triple mustache: `{{{name}}}`.
56
+
57
+ By default a variable "miss" returns an empty string. This can usually
58
+ be configured in your Mustache library.
59
+
60
+ Template:
61
+
62
+ * {{name}}
63
+ * {{age}}
64
+ * {{company}}
65
+ * {{{company}}}
66
+
67
+ Hash:
68
+
69
+ {
70
+ "name": "Chris",
71
+ "company": "<b>GitHub</b>"
72
+ }
73
+
74
+ Output:
75
+
76
+ * Chris
77
+ *
78
+ * &lt;b&gt;GitHub&lt;/b&gt;
79
+ * <b>GitHub</b>
80
+
81
+ ### Boolean Sections
82
+
83
+ A section begins with a pound and ends with a slash. That is,
84
+ `{{#person}}` begins a "person" section while `{{/person}}` ends it.
85
+
86
+ If the `person` key exists and calling it returns false, the HTML
87
+ between the pound and slash will not be displayed.
88
+
89
+ If the `person` method exists and calling it returns true, the HTML
90
+ between the pound and slash will be rendered and displayed.
91
+
92
+ Template:
93
+
94
+ {{#person}}
95
+ Shown!
96
+ {{/person}}
97
+ {{#anything_else}}
98
+ Never shown!
99
+ {{/anything_else}}
100
+
101
+ Hash:
102
+
103
+ {
104
+ "person": true
105
+ }
106
+
107
+ Output:
108
+
109
+ Shown!
110
+
111
+ ### Enumerable Sections
112
+
113
+ Enumerable sections are syntactically identical to boolean sections in
114
+ that they begin with a pound and end with a slash. The difference,
115
+ however, is in the view: if the method called returns an enumerable,
116
+ the section is repeated as the enumerable is iterated over.
117
+
118
+ Each item in the enumerable is expected to be a hash which will then
119
+ become the context of the corresponding iteration. In this way we can
120
+ construct loops.
121
+
122
+ Template:
123
+
124
+ {{#repo}}
125
+ <b>{{name}}</b>
126
+ {{/repo}}
127
+
128
+ Hash:
129
+
130
+ {
131
+ "repo": [
132
+ { "name": "resque" },
133
+ { "name": "hub" },
134
+ { "name": "rip" },
135
+ ]
136
+ }
137
+
138
+ Output:
139
+
140
+ <b>resque</b>
141
+ <b>hub</b>
142
+ <b>rip</b>
143
+
144
+
145
+ ### Comments
146
+
147
+ Comments begin with a bang and are ignored. The following template:
148
+
149
+ <h1>Today{{! ignore me }}.</h1>
150
+
151
+ Will render as follows:
152
+
153
+ <h1>Today.</h1>
154
+
155
+
156
+ ### Partials
157
+
158
+ Partials begin with a greater than sign, like `{{> box}}`.
159
+
160
+ It is useful to think of partials as a "template expansion" - that is,
161
+ the actual partial tag will be replaced with the content of the
162
+ partial. Therefor partials share the current context.
163
+
164
+ For example, this template and partial:
165
+
166
+ base.mustache:
167
+ <h2>Names</h2>
168
+ {{# names }}
169
+ {{> user }}
170
+ {{/ names }}
171
+
172
+ user.mustache:
173
+ <strong>{{ name }}</strong>
174
+
175
+ Can be thought of as a single, expanded template:
176
+
177
+ <h2>Names</h2>
178
+ {{# names }}
179
+ <strong>{{ name }}</strong>
180
+ {{/ names }}
181
+
182
+
183
+ ### Set Delimiter
184
+
185
+ Set Delimiter tags start with an equal sign and change the tag
186
+ delimiters from {{ and }} to custom strings.
187
+
188
+ Consider the following contrived example:
189
+
190
+ * {{ default_tags }}
191
+ {{=<% %>=}}
192
+ * <% erb_style_tags %>
193
+ <%={{ }}=%>
194
+ * {{ default_tags_again }}
195
+
196
+ Here we have a list with three items. The first item uses the default
197
+ tag style, the second uses erb style as defined by the Set Delimiter
198
+ tag, and the third returns to the default style after yet another Set
199
+ Delimiter declaration.
200
+
201
+ According to [ctemplates][ct], this "is useful for languages like TeX, where
202
+ double-braces may occur in the text and are awkward to use for
203
+ markup."
204
+
205
+ Custom delimiters may not contain whitespace or the equals sign.
206
+
207
+ [ct]: http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html
208
+
209
+
210
+ ## COPYRIGHT
211
+
212
+ Mustache is Copyright (C) 2009 Chris Wanstrath
213
+
214
+ Original CTemplate by Google
215
+
216
+
217
+ ## SEE ALSO
218
+
219
+ mustache(1), mustache(7), gem(1),
220
+ <http://defunkt.github.com/mustache/>
data/test/helper.rb CHANGED
@@ -11,3 +11,4 @@ require 'comments'
11
11
  require 'passenger'
12
12
  require 'delimiters'
13
13
  require 'double_section'
14
+ require 'nested_objects'
@@ -21,17 +21,17 @@ end_passenger
21
21
  <li><a href="#Blue">blue</a></li>
22
22
  </ul>
23
23
  end_complex
24
+ end
24
25
 
25
- # TODO: Preserve indentation
26
- # http://github.com/defunkt/mustache/issues#issue/2
27
- # assert_equal <<-end_complex, ComplexView.render
28
- # <h1>Colors</h1>
29
- # <ul>
30
- # <li><strong>red</strong></li>
31
- # <li><a href="#Green">green</a></li>
32
- # <li><a href="#Blue">blue</a></li>
33
- # </ul>
34
- # end_complex
26
+ def test_nested_objects
27
+ assert_equal <<-end_complex, NestedObjects.render
28
+ <h1>Colors</h1>
29
+ <ul>
30
+ <li><strong>red</strong></li>
31
+ <li><a href="#Green">green</a></li>
32
+ <li><a href="#Blue">blue</a></li>
33
+ </ul>
34
+ end_complex
35
35
  end
36
36
 
37
37
  def test_single_line_sections
@@ -125,6 +125,12 @@ end_section
125
125
  assert_equal "<h1>A Comedy of Errors</h1>\n", Comments.render
126
126
  end
127
127
 
128
+ def test_multi_linecomments
129
+ view = Comments.new
130
+ view.template = "<h1>{{title}}{{! just something interesting... \n#or not... }}</h1>\n"
131
+ assert_equal "<h1>A Comedy of Errors</h1>\n", view.render
132
+ end
133
+
128
134
  def test_escaped
129
135
  assert_equal '<h1>Bear &gt; Shark</h1>', Escaped.render
130
136
  end
@@ -172,14 +178,17 @@ data
172
178
  :deploy_to => '/var/www/example.com' )
173
179
  end
174
180
 
175
- def test_reports_type_errors_in_sections
181
+ def test_doesnt_execute_what_it_doesnt_need_to
176
182
  instance = Mustache.new
177
- instance[:list] = [ :item, 1234 ]
178
- instance.template = '{{#list}} <li>{{item}}</li> {{/list}}'
179
-
180
- assert_raise TypeError do
181
- instance.render
183
+ instance[:show] = false
184
+ instance.instance_eval do
185
+ def die
186
+ raise "bummer"
187
+ end
182
188
  end
189
+ instance.template = '{{#show}} <li>{{die}}</li> {{/show}} yay'
190
+
191
+ assert_equal "yay", instance.render
183
192
  end
184
193
 
185
194
  def test_reports_unclosed_sections
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mustache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
@@ -9,68 +9,49 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-23 00:00:00 -08:00
13
- default_executable: mustache
12
+ date: 2010-03-08 00:00:00 -08:00
13
+ default_executable:
14
14
  dependencies: []
15
15
 
16
- description: Mustache is a framework-agnostic way to render logic-free views.
16
+ description: |
17
+ Inspired by ctemplate, Mustache is a framework-agnostic way to render
18
+ logic-free views.
19
+
20
+ As ctemplates says, "It emphasizes separating logic from presentation:
21
+ it is impossible to embed application logic in this template
22
+ language.
23
+
24
+ Think of Mustache as a replacement for your views. Instead of views
25
+ consisting of ERB or HAML with random helpers and arbitrary logic,
26
+ your views are broken into two parts: a Ruby class and an HTML
27
+ template.
28
+
17
29
  email: chris@ozmm.org
18
30
  executables:
19
31
  - mustache
20
32
  extensions: []
21
33
 
22
- extra_rdoc_files:
23
- - LICENSE
24
- - README.md
34
+ extra_rdoc_files: []
35
+
25
36
  files:
26
- - .gitignore
27
- - .kick
28
- - CONTRIBUTORS
29
- - HISTORY.md
30
- - LICENSE
31
37
  - README.md
32
38
  - Rakefile
33
- - benchmarks/complex.erb
34
- - benchmarks/complex.haml
35
- - benchmarks/helper.rb
36
- - benchmarks/simple.erb
37
- - benchmarks/speed.rb
38
- - bin/mustache
39
- - contrib/mustache.vim
40
- - contrib/tpl-mode.el
41
- - examples/comments.mustache
42
- - examples/comments.rb
43
- - examples/complex_view.mustache
44
- - examples/complex_view.rb
45
- - examples/delimiters.mustache
46
- - examples/delimiters.rb
47
- - examples/double_section.mustache
48
- - examples/double_section.rb
49
- - examples/escaped.mustache
50
- - examples/escaped.rb
51
- - examples/inner_partial.mustache
52
- - examples/inner_partial.txt
53
- - examples/namespaced.mustache
54
- - examples/namespaced.rb
55
- - examples/partial_with_module.mustache
56
- - examples/partial_with_module.rb
57
- - examples/passenger.conf
58
- - examples/passenger.rb
59
- - examples/simple.mustache
60
- - examples/simple.rb
61
- - examples/template_partial.mustache
62
- - examples/template_partial.rb
63
- - examples/template_partial.txt
64
- - examples/unescaped.mustache
65
- - examples/unescaped.rb
66
- - lib/mustache.rb
39
+ - LICENSE
67
40
  - lib/mustache/context.rb
68
41
  - lib/mustache/sinatra.rb
69
42
  - lib/mustache/template.rb
70
43
  - lib/mustache/version.rb
71
- - lib/rack/bug/panels/mustache_panel.rb
44
+ - lib/mustache.rb
72
45
  - lib/rack/bug/panels/mustache_panel/mustache_extension.rb
73
46
  - lib/rack/bug/panels/mustache_panel/view.mustache
47
+ - lib/rack/bug/panels/mustache_panel.rb
48
+ - bin/mustache
49
+ - man/mustache.1
50
+ - man/mustache.1.html
51
+ - man/mustache.1.ron
52
+ - man/mustache.5
53
+ - man/mustache.5.html
54
+ - man/mustache.5.ron
74
55
  - test/autoloading_test.rb
75
56
  - test/helper.rb
76
57
  - test/mustache_test.rb
@@ -80,8 +61,8 @@ homepage: http://github.com/defunkt/mustache
80
61
  licenses: []
81
62
 
82
63
  post_install_message:
83
- rdoc_options:
84
- - --charset=UTF-8
64
+ rdoc_options: []
65
+
85
66
  require_paths:
86
67
  - lib
87
68
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -103,19 +84,5 @@ rubygems_version: 1.3.5
103
84
  signing_key:
104
85
  specification_version: 3
105
86
  summary: Mustache is a framework-agnostic way to render logic-free views.
106
- test_files:
107
- - test/autoloading_test.rb
108
- - test/helper.rb
109
- - test/mustache_test.rb
110
- - test/partial_test.rb
111
- - examples/comments.rb
112
- - examples/complex_view.rb
113
- - examples/delimiters.rb
114
- - examples/double_section.rb
115
- - examples/escaped.rb
116
- - examples/namespaced.rb
117
- - examples/partial_with_module.rb
118
- - examples/passenger.rb
119
- - examples/simple.rb
120
- - examples/template_partial.rb
121
- - examples/unescaped.rb
87
+ test_files: []
88
+
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- docs
data/.kick DELETED
@@ -1,26 +0,0 @@
1
- # take control of the growl notifications
2
- module GrowlHacks
3
- def growl(type, subject, body, *args, &block)
4
- case type
5
- when Kicker::GROWL_NOTIFICATIONS[:succeeded]
6
- puts subject = "Success"
7
- body = body.split("\n").last
8
- when Kicker::GROWL_NOTIFICATIONS[:failed]
9
- subject = "Failure"
10
- puts body
11
- body = body.split("\n").last
12
- else
13
- return nil
14
- end
15
- super(type, subject, body, *args, &block)
16
- end
17
- end
18
-
19
- Kicker.send :extend, GrowlHacks
20
-
21
- # no logging
22
- Kicker::Utils.module_eval do
23
- def log(message)
24
- nil
25
- end
26
- end
data/CONTRIBUTORS DELETED
@@ -1,6 +0,0 @@
1
- * Chris Wanstrath
2
- * Francesc Esplugas
3
- * Magnus Holm
4
- * Nicolas Sanguinetti
5
- * Jan-Erik Rediger
6
- * Aaron Patterson
data/HISTORY.md DELETED
@@ -1,70 +0,0 @@
1
- ## 0.5.0 (2009-11-23)
2
-
3
- * Partial classes are no longer supported. Use modules!
4
- * Added `mustache` script for rendering templates on the command line.
5
- * ctemplate compat: Partials are indicated by >, not <
6
- * Bugfix: Context miss should return nil, not empty string. Fixes 1.9.x
7
-
8
- ## 0.4.2 (2009-10-28)
9
-
10
- * Bugfix: Ignore bad constant names when autoloading
11
-
12
- ## 0.4.1 (2009-10-27)
13
-
14
- * Partials now respect the `view_namespace` setting.
15
- * Added tpl-mode.el to contrib/ for us Emacs users.
16
- * Rack::Bug bugfix: ensure benchmark is required before using it
17
- * Rack::Bug: truncate too-large variables (click expands them)
18
-
19
- ## 0.4.0 (2009-10-27)
20
-
21
- * Stopped raising context miss exceptions by default
22
- * Added `Mustache.raise_on_context_miss` setting (defaults to false)
23
- * Throw Mustache::ContextMiss when raise_on_context_miss is true and
24
- we encounter a miss.
25
- * The default template extension is now "mustache" (instead of "html").
26
- * Added the `view_namespace` and `view_path` settings to `Mustache`
27
- * Added `Mustache.view_class` method which autoloads a class using the
28
- new `view_namespace` and `view_path` settings. Should be used by
29
- plugin developers.
30
- * Updated the Sinatra extension to use the new `view_class` method
31
- * Unclosed sections now throw a helpful error message
32
- * Report line numbers on unclosed section errors
33
- * Added Rack::Bug panel
34
-
35
- ## 0.3.2 (2009-10-19)
36
-
37
- * Bugfix: Partials in Sinatra were using the wrong path.
38
-
39
- ## 0.3.1 (2009-10-19)
40
-
41
- * Added mustache.vim to contrib/ (Thanks Juvenn Woo!)
42
- * Support string keys in contexts (not just symbol keys).
43
- * Bugfix: # and / were not permitted in tag names. Now they are.
44
- * Bugfix: Partials in Sinatra needed to know their extension and path
45
- * Bugfix: Using the same boolean section twice was failing
46
-
47
- ## 0.3.0 (2009-10-14)
48
-
49
- * Set Delimiter tags are now supported. See the README
50
- * Improved error message when an enumerable section did not return all
51
- hashes.
52
- * Added a shortcut: if a section's value is a single hash, treat is as
53
- a one element array whose value is the hash.
54
- * Bugfix: String templates set at the class level were not compiled
55
- * Added a class-level `compiled?` method for checking if a template
56
- has been compiled.
57
- * Added an instance-level `compiled?` method.
58
- * Cache template compilation in Sinatra
59
-
60
- ## 0.2.2 (2009-10-11)
61
-
62
- * Improved documentation
63
- * Fixed single line sections
64
- * Broke preserved indentation (issue #2)
65
-
66
- ## 0.2.1 (2009-10-11)
67
-
68
- * Mustache.underscore can now be called without an argument
69
- * Settings now mostly live at the class level, excepting `template`
70
- * Any setting changes causes the template to be recompiled
@@ -1,15 +0,0 @@
1
- <h1><%= header %></h1>
2
- <% if not item.empty? %>
3
- <ul>
4
- <% for i in item %>
5
- <% if i[:current] %>
6
- <li><strong><%= i[:name] %></strong></li>
7
- <% else %>
8
- <li><a href="<%= i[:url] %>"><%= i[:name] %></a></li>
9
- <% end %>
10
- <% end %>
11
- </ul>
12
- <% end %>
13
- <% if item.empty? %>
14
- <p>The list is empty.</p>
15
- <% end %>
@@ -1,10 +0,0 @@
1
- %h1= header
2
- - item.each do |i|
3
- %ul
4
- - if i[:current]
5
- %li= i[:name]
6
- - else
7
- %li
8
- %a{:href => i[:url]}= i[:name]
9
- - if item.empty?
10
- %p= The list is empty.
data/benchmarks/helper.rb DELETED
@@ -1,20 +0,0 @@
1
- require 'benchmark'
2
-
3
- count = (ENV['COUNT'] || 5000).to_i
4
-
5
- $benches = []
6
- def bench(name, &block)
7
- $benches.push([name, block])
8
- end
9
-
10
- at_exit do
11
- Benchmark.bmbm do |x|
12
- $benches.each do |name, block|
13
- x.report name.to_s do
14
- count.times do
15
- block.call
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,5 +0,0 @@
1
- Hello <%= name %>
2
- You have just won $<%= value %>!
3
- <% if in_ca %>
4
- Well, $<%= taxed_value %>, after taxes.
5
- <% end %>
data/benchmarks/speed.rb DELETED
@@ -1,76 +0,0 @@
1
- require 'erb'
2
-
3
- $LOAD_PATH.unshift File.dirname(__FILE__)
4
- require 'helper'
5
-
6
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../examples'
7
- require 'complex_view'
8
-
9
- ## erb
10
- template = File.read(File.dirname(__FILE__) + '/complex.erb')
11
-
12
- unless ENV['NOERB']
13
- erb = ERB.new(template)
14
- scope = ComplexView.new.send(:binding)
15
- bench 'ERB w/ caching' do
16
- erb.result(scope)
17
- end
18
-
19
- unless ENV['CACHED']
20
- scope = ComplexView.new.send(:binding)
21
- bench 'ERB w/o caching' do
22
- ERB.new(template).result(scope)
23
- end
24
- end
25
- end
26
-
27
-
28
- ## haml
29
- require 'haml'
30
- template = File.read(File.dirname(__FILE__) + '/complex.haml')
31
-
32
- unless ENV['NOHAML']
33
- haml = Haml::Engine.new(template)
34
- scope = ComplexView.new.send(:binding)
35
- bench 'HAML w/ caching' do
36
- haml.render(scope)
37
- end
38
-
39
- unless ENV['CACHED']
40
- scope = ComplexView.new.send(:binding)
41
- bench 'HAML w/o caching' do
42
- Haml::Engine.new(template).render(scope)
43
- end
44
- end
45
- end
46
-
47
-
48
- ## mustache
49
- tpl = ComplexView.new
50
- tpl.template
51
-
52
- tpl[:header] = 'Chris'
53
- tpl[:empty] = false
54
- tpl[:list] = true
55
-
56
- items = []
57
- items << { :name => 'red', :current => true, :url => '#Red' }
58
- items << { :name => 'green', :current => false, :url => '#Green' }
59
- items << { :name => 'blue', :current => false, :url => '#Blue' }
60
-
61
- tpl[:item] = items
62
-
63
- bench '{{ w/ caching' do
64
- tpl.to_html
65
- end
66
-
67
- content = File.read(ComplexView.template_file)
68
-
69
- unless ENV['CACHED']
70
- bench '{{ w/o caching' do
71
- ctpl = ComplexView.new
72
- ctpl.template = content
73
- ctpl[:item] = items
74
- ctpl.to_html
75
- end
76
- end