tenjin 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/CHANGES.txt +46 -0
  2. data/MIT-LICENSE +1 -1
  3. data/README.txt +7 -7
  4. data/bin/rbtenjin +2 -2
  5. data/doc-api/classes/Tenjin.html +2 -2
  6. data/doc-api/classes/Tenjin/ArrayBufferTemplate.html +28 -28
  7. data/doc-api/classes/Tenjin/BaseContext.html +61 -44
  8. data/doc-api/classes/Tenjin/ContextHelper.html +85 -57
  9. data/doc-api/classes/Tenjin/Engine.html +88 -88
  10. data/doc-api/classes/Tenjin/ErubisTemplate.html +7 -7
  11. data/doc-api/classes/Tenjin/Preprocessor.html +28 -28
  12. data/doc-api/classes/Tenjin/Template.html +142 -142
  13. data/doc-api/created.rid +1 -1
  14. data/doc-api/files/README_txt.html +10 -10
  15. data/doc-api/files/lib/tenjin_rb.html +2 -2
  16. data/doc-api/fr_method_index.html +55 -53
  17. data/doc/examples.html +2 -2
  18. data/doc/faq.html +2 -2
  19. data/doc/users-guide.html +47 -4
  20. data/examples/form/Makefile +5 -0
  21. data/examples/form/Rakefile +7 -0
  22. data/examples/form/create.rbhtml +4 -0
  23. data/examples/form/form.rbhtml +14 -0
  24. data/examples/form/layout.rbhtml +8 -0
  25. data/examples/form/main.rb +9 -0
  26. data/examples/form/update.rbhtml +4 -0
  27. data/examples/preprocessing/Makefile +8 -0
  28. data/examples/preprocessing/Rakefile +11 -0
  29. data/examples/preprocessing/helper.rb +16 -0
  30. data/examples/preprocessing/main.rb +11 -0
  31. data/examples/preprocessing/select.rbhtml +15 -0
  32. data/examples/table/Makefile +5 -0
  33. data/examples/table/Rakefile +7 -0
  34. data/examples/table/table.rb +9 -0
  35. data/examples/table/table.rbhtml +16 -0
  36. data/lib/tenjin.rb +28 -18
  37. data/setup.rb +861 -607
  38. data/tenjin.gemspec +16 -12
  39. data/test/assert-text-equal.rb +2 -2
  40. data/test/data/users_guide/example16d.rb +27 -0
  41. data/test/data/users_guide/example16d.result +4 -0
  42. data/test/test_all.rb +2 -2
  43. data/test/test_engine.rb +2 -2
  44. data/test/test_examples.rb +2 -2
  45. data/test/test_faq.rb +2 -2
  46. data/test/test_htmlhelper.rb +2 -2
  47. data/test/test_main.rb +2 -2
  48. data/test/test_template.rb +2 -2
  49. data/test/test_users_guide.rb +2 -2
  50. data/test/testcase-helper.rb +2 -2
  51. metadata +64 -35
@@ -0,0 +1,46 @@
1
+ =begin
2
+ = CHANGES
3
+
4
+ == Release 0.6.1 (2007-02-07)
5
+
6
+ === Enhancements
7
+
8
+ * It is able to make any class which includes
9
+ Tenjin::ContextHelper module as context object class.
10
+ This is useful if you want to define helper functions
11
+ as instance method of that class.
12
+ See section 'Add Your Helper Functions' for details.
13
+ http://www.kuwata-lab.com/tenjin/rbtenjin-users-guide.html#dev-helpers
14
+
15
+ ex.
16
+ require 'tenjin'
17
+
18
+ class MyClass
19
+ include Tenjin::ContextHelper
20
+ #include Tenjin::HtmlHelper # optional
21
+
22
+ ## define helper functions in current class
23
+ def link_to(label, url)
24
+ return "<a href=\"#{escape(url)}\">#{escape(label)}</a>"
25
+ end
26
+
27
+ def render_template(template_name)
28
+ engine = Tenjin::Engine.new()
29
+ ## pass self as context object
30
+ output = engine.render(template_name, self)
31
+ return output
32
+ end
33
+
34
+ def main
35
+ ## set context data as instance variables
36
+ @label = 'Top'
37
+ @url = '/'
38
+ output = render_template('example.rbhtml')
39
+ print output
40
+ end
41
+
42
+ end
43
+
44
+ MyClass.new.main()
45
+
46
+ =end
@@ -1,4 +1,4 @@
1
- copyright(c) 2007 kuwata-lab all rights reserved.
1
+ copyright(c) 2007-2008 kuwata-lab.com all rights reserved.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.txt CHANGED
@@ -1,12 +1,12 @@
1
1
  = README
2
2
 
3
- release:: 0.6.0
4
- copyright:: copyright(c) 2007 kuwata-lab all rights reserved.
3
+ release:: 0.6.1
4
+ copyright:: copyright(c) 2007-2008 kuwata-lab.com all rights reserved.
5
5
 
6
6
 
7
7
  == About
8
8
 
9
- rbTenjin is a very fast and full-featured template engine based on embedded Ruby.
9
+ rbTenjin is a very fast and full-featured template engine.
10
10
  You can embed Ruby statements and expressions into your text file.
11
11
  rbTenjin converts it into Ruby program and evaluate it.
12
12
 
@@ -14,7 +14,7 @@ rbTenjin converts it into Ruby program and evaluate it.
14
14
  == Features
15
15
 
16
16
  * Very fast (twice faster than eruby and three times faster than ERB)
17
- * Lightweight (only one file which contains about 1000 lines)
17
+ * Lightweight (only a file which contains about 1000 lines)
18
18
  * Not break HTML design because it uses XML Processing
19
19
  Instructions (PI) as embedded notation for Python statements.
20
20
  * Secure because it supports escaping expression value by default.
@@ -34,11 +34,11 @@ See doc/*.html for details.
34
34
 
35
35
  $ sudo gem install tenjin
36
36
 
37
- * Else download rbtenjin-X.X.X.tar.bz2 and just copy 'lib/tenjin.rb' and
37
+ * Else download rbtenjin-0.6.1.tar.bz2 and just copy 'lib/tenjin.rb' and
38
38
  'bin/rbtenjin' into proper directory.
39
39
 
40
- $ tar xjf rbtenjin-X.X.X.tar.bz2
41
- $ cd rbtenjin-X.X.X/
40
+ $ tar xjf rbtenjin-0.6.1.tar.bz2
41
+ $ cd rbtenjin-0.6.1/
42
42
  $ sudo copy lib/tenjin.rb /usr/local/lib/ruby/1.8/site_ruby/1.8/
43
43
  $ sudo copy bin/rbtenjin /usr/local/bin/
44
44
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  ##
4
- ## copyright(c) 2007 kuwata-lab all rights reserved.
4
+ ## copyright(c) 2007-2008 kuwata-lab.com all rights reserved.
5
5
  ##
6
6
  ## Permission is hereby granted, free of charge, to any person obtaining
7
7
  ## a copy of this software and associated documentation files (the
@@ -24,7 +24,7 @@
24
24
  ##
25
25
 
26
26
  ## $Rev: 59 $
27
- ## $Release: 0.6.0 $
27
+ ## $Release: 0.6.1 $
28
28
 
29
29
  require 'tenjin'
30
30
 
@@ -77,7 +77,7 @@
77
77
  <a href="Tenjin.html">Tenjin</a> module
78
78
  </p>
79
79
  <p>
80
- $Rev: 59 $ $Release: 0.6.0 $
80
+ $Rev: 65 $ $Release: 0.6.1 $
81
81
  </p>
82
82
 
83
83
  </div>
@@ -116,7 +116,7 @@ Class <a href="Tenjin/Template.html" class="link">Tenjin::Template</a><br />
116
116
  <tr class="top-aligned-row context-row">
117
117
  <td class="context-item-name">RELEASE</td>
118
118
  <td>=</td>
119
- <td class="context-item-value">('$Release: 0.6.0 $' =~ /[\d.]+/) &amp;&amp; $&amp;</td>
119
+ <td class="context-item-value">('$Release: 0.6.1 $' =~ /[\d.]+/) &amp;&amp; $&amp;</td>
120
120
  </tr>
121
121
  </table>
122
122
  </div>
@@ -121,10 +121,10 @@ result:
121
121
  <h3 class="section-bar">Methods</h3>
122
122
 
123
123
  <div class="name-list">
124
- <a href="#M000018">expr_pattern</a>&nbsp;&nbsp;
125
- <a href="#M000019">parse_exprs</a>&nbsp;&nbsp;
126
- <a href="#M000021">quote_expr</a>&nbsp;&nbsp;
127
- <a href="#M000020">quote_str</a>&nbsp;&nbsp;
124
+ <a href="#M000019">expr_pattern</a>&nbsp;&nbsp;
125
+ <a href="#M000020">parse_exprs</a>&nbsp;&nbsp;
126
+ <a href="#M000022">quote_expr</a>&nbsp;&nbsp;
127
+ <a href="#M000021">quote_str</a>&nbsp;&nbsp;
128
128
  </div>
129
129
  </div>
130
130
 
@@ -146,21 +146,21 @@ result:
146
146
  <div id="methods">
147
147
  <h3 class="section-bar">Protected Instance methods</h3>
148
148
 
149
- <div id="method-M000018" class="method-detail">
150
- <a name="M000018"></a>
149
+ <div id="method-M000019" class="method-detail">
150
+ <a name="M000019"></a>
151
151
 
152
152
  <div class="method-heading">
153
- <a href="#M000018" class="method-signature">
153
+ <a href="#M000019" class="method-signature">
154
154
  <span class="method-name">expr_pattern</span><span class="method-args">()</span>
155
155
  </a>
156
156
  </div>
157
157
 
158
158
  <div class="method-description">
159
159
  <p><a class="source-toggle" href="#"
160
- onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
161
- <div class="method-source-code" id="M000018-source">
160
+ onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
161
+ <div class="method-source-code" id="M000019-source">
162
162
  <pre>
163
- <span class="ruby-comment cmt"># File lib/tenjin.rb, line 686</span>
163
+ <span class="ruby-comment cmt"># File lib/tenjin.rb, line 696</span>
164
164
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expr_pattern</span>
165
165
  <span class="ruby-keyword kw">return</span> <span class="ruby-regexp re">/([\#$])\{(.*?)\}/</span>
166
166
  <span class="ruby-keyword kw">end</span>
@@ -169,11 +169,11 @@ result:
169
169
  </div>
170
170
  </div>
171
171
 
172
- <div id="method-M000019" class="method-detail">
173
- <a name="M000019"></a>
172
+ <div id="method-M000020" class="method-detail">
173
+ <a name="M000020"></a>
174
174
 
175
175
  <div class="method-heading">
176
- <a href="#M000019" class="method-signature">
176
+ <a href="#M000020" class="method-signature">
177
177
  <span class="method-name">parse_exprs</span><span class="method-args">(input)</span>
178
178
  </a>
179
179
  </div>
@@ -183,10 +183,10 @@ result:
183
183
  parse expressions (&#8217;#{&#8230;}&#8217; and &#8217;${&#8230;}&#8217;)
184
184
  </p>
185
185
  <p><a class="source-toggle" href="#"
186
- onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
187
- <div class="method-source-code" id="M000019-source">
186
+ onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
187
+ <div class="method-source-code" id="M000020-source">
188
188
  <pre>
189
- <span class="ruby-comment cmt"># File lib/tenjin.rb, line 691</span>
189
+ <span class="ruby-comment cmt"># File lib/tenjin.rb, line 701</span>
190
190
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_exprs</span>(<span class="ruby-identifier">input</span>)
191
191
  <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">input</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">input</span>.<span class="ruby-identifier">empty?</span>
192
192
  <span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
@@ -208,21 +208,21 @@ parse expressions (&#8217;#{&#8230;}&#8217; and &#8217;${&#8230;}&#8217;)
208
208
  </div>
209
209
  </div>
210
210
 
211
- <div id="method-M000021" class="method-detail">
212
- <a name="M000021"></a>
211
+ <div id="method-M000022" class="method-detail">
212
+ <a name="M000022"></a>
213
213
 
214
214
  <div class="method-heading">
215
- <a href="#M000021" class="method-signature">
215
+ <a href="#M000022" class="method-signature">
216
216
  <span class="method-name">quote_expr</span><span class="method-args">(expr, flag_escape)</span>
217
217
  </a>
218
218
  </div>
219
219
 
220
220
  <div class="method-description">
221
221
  <p><a class="source-toggle" href="#"
222
- onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
223
- <div class="method-source-code" id="M000021-source">
222
+ onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
223
+ <div class="method-source-code" id="M000022-source">
224
224
  <pre>
225
- <span class="ruby-comment cmt"># File lib/tenjin.rb, line 713</span>
225
+ <span class="ruby-comment cmt"># File lib/tenjin.rb, line 723</span>
226
226
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quote_expr</span>(<span class="ruby-identifier">expr</span>, <span class="ruby-identifier">flag_escape</span>)
227
227
  <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">flag_escape</span> <span class="ruby-operator">?</span> <span class="ruby-node">&quot;#{@escapefunc}((#{expr}).to_s)&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-node">&quot;(#{expr}).to_s&quot;</span> <span class="ruby-comment cmt"># or &quot;(#{expr})&quot;</span>
228
228
  <span class="ruby-keyword kw">end</span>
@@ -231,21 +231,21 @@ parse expressions (&#8217;#{&#8230;}&#8217; and &#8217;${&#8230;}&#8217;)
231
231
  </div>
232
232
  </div>
233
233
 
234
- <div id="method-M000020" class="method-detail">
235
- <a name="M000020"></a>
234
+ <div id="method-M000021" class="method-detail">
235
+ <a name="M000021"></a>
236
236
 
237
237
  <div class="method-heading">
238
- <a href="#M000020" class="method-signature">
238
+ <a href="#M000021" class="method-signature">
239
239
  <span class="method-name">quote_str</span><span class="method-args">(text)</span>
240
240
  </a>
241
241
  </div>
242
242
 
243
243
  <div class="method-description">
244
244
  <p><a class="source-toggle" href="#"
245
- onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
246
- <div class="method-source-code" id="M000020-source">
245
+ onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
246
+ <div class="method-source-code" id="M000021-source">
247
247
  <pre>
248
- <span class="ruby-comment cmt"># File lib/tenjin.rb, line 708</span>
248
+ <span class="ruby-comment cmt"># File lib/tenjin.rb, line 718</span>
249
249
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quote_str</span>(<span class="ruby-identifier">text</span>)
250
250
  <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/[\'\\]/</span>, <span class="ruby-value str">'\\\\\&amp;'</span>)
251
251
  <span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;'#{text}'&quot;</span>
@@ -92,12 +92,13 @@ base class for <a href="Context.html">Context</a> class
92
92
  <h3 class="section-bar">Methods</h3>
93
93
 
94
94
  <div class="name-list">
95
- <a href="#M000023">[]</a>&nbsp;&nbsp;
96
- <a href="#M000024">[]=</a>&nbsp;&nbsp;
97
- <a href="#M000028">each</a>&nbsp;&nbsp;
98
- <a href="#M000025">escape</a>&nbsp;&nbsp;
95
+ <a href="#M000024">[]</a>&nbsp;&nbsp;
96
+ <a href="#M000025">[]=</a>&nbsp;&nbsp;
97
+ <a href="#M000030">each</a>&nbsp;&nbsp;
98
+ <a href="#M000029">has_key?</a>&nbsp;&nbsp;
99
+ <a href="#M000028">key?</a>&nbsp;&nbsp;
99
100
  <a href="#M000027">key?</a>&nbsp;&nbsp;
100
- <a href="#M000022">new</a>&nbsp;&nbsp;
101
+ <a href="#M000023">new</a>&nbsp;&nbsp;
101
102
  <a href="#M000026">update</a>&nbsp;&nbsp;
102
103
  </div>
103
104
  </div>
@@ -128,21 +129,21 @@ base class for <a href="Context.html">Context</a> class
128
129
  <div id="methods">
129
130
  <h3 class="section-bar">Public Class methods</h3>
130
131
 
131
- <div id="method-M000022" class="method-detail">
132
- <a name="M000022"></a>
132
+ <div id="method-M000023" class="method-detail">
133
+ <a name="M000023"></a>
133
134
 
134
135
  <div class="method-heading">
135
- <a href="#M000022" class="method-signature">
136
+ <a href="#M000023" class="method-signature">
136
137
  <span class="method-name">new</span><span class="method-args">(vars=nil)</span>
137
138
  </a>
138
139
  </div>
139
140
 
140
141
  <div class="method-description">
141
142
  <p><a class="source-toggle" href="#"
142
- onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
143
- <div class="method-source-code" id="M000022-source">
143
+ onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
144
+ <div class="method-source-code" id="M000023-source">
144
145
  <pre>
145
- <span class="ruby-comment cmt"># File lib/tenjin.rb, line 231</span>
146
+ <span class="ruby-comment cmt"># File lib/tenjin.rb, line 236</span>
146
147
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">vars</span>=<span class="ruby-keyword kw">nil</span>)
147
148
  <span class="ruby-identifier">update</span>(<span class="ruby-identifier">vars</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">vars</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
148
149
  <span class="ruby-keyword kw">end</span>
@@ -153,21 +154,21 @@ base class for <a href="Context.html">Context</a> class
153
154
 
154
155
  <h3 class="section-bar">Public Instance methods</h3>
155
156
 
156
- <div id="method-M000023" class="method-detail">
157
- <a name="M000023"></a>
157
+ <div id="method-M000024" class="method-detail">
158
+ <a name="M000024"></a>
158
159
 
159
160
  <div class="method-heading">
160
- <a href="#M000023" class="method-signature">
161
+ <a href="#M000024" class="method-signature">
161
162
  <span class="method-name">[]</span><span class="method-args">(key)</span>
162
163
  </a>
163
164
  </div>
164
165
 
165
166
  <div class="method-description">
166
167
  <p><a class="source-toggle" href="#"
167
- onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
168
- <div class="method-source-code" id="M000023-source">
168
+ onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
169
+ <div class="method-source-code" id="M000024-source">
169
170
  <pre>
170
- <span class="ruby-comment cmt"># File lib/tenjin.rb, line 235</span>
171
+ <span class="ruby-comment cmt"># File lib/tenjin.rb, line 240</span>
171
172
  <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
172
173
  <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-node">&quot;@#{key}&quot;</span>)
173
174
  <span class="ruby-keyword kw">end</span>
@@ -176,21 +177,21 @@ base class for <a href="Context.html">Context</a> class
176
177
  </div>
177
178
  </div>
178
179
 
179
- <div id="method-M000024" class="method-detail">
180
- <a name="M000024"></a>
180
+ <div id="method-M000025" class="method-detail">
181
+ <a name="M000025"></a>
181
182
 
182
183
  <div class="method-heading">
183
- <a href="#M000024" class="method-signature">
184
+ <a href="#M000025" class="method-signature">
184
185
  <span class="method-name">[]=</span><span class="method-args">(key, val)</span>
185
186
  </a>
186
187
  </div>
187
188
 
188
189
  <div class="method-description">
189
190
  <p><a class="source-toggle" href="#"
190
- onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
191
- <div class="method-source-code" id="M000024-source">
191
+ onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
192
+ <div class="method-source-code" id="M000025-source">
192
193
  <pre>
193
- <span class="ruby-comment cmt"># File lib/tenjin.rb, line 239</span>
194
+ <span class="ruby-comment cmt"># File lib/tenjin.rb, line 244</span>
194
195
  <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>)
195
196
  <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">&quot;@#{key}&quot;</span>, <span class="ruby-identifier">val</span>)
196
197
  <span class="ruby-keyword kw">end</span>
@@ -199,26 +200,28 @@ base class for <a href="Context.html">Context</a> class
199
200
  </div>
200
201
  </div>
201
202
 
202
- <div id="method-M000028" class="method-detail">
203
- <a name="M000028"></a>
203
+ <div id="method-M000030" class="method-detail">
204
+ <a name="M000030"></a>
204
205
 
205
206
  <div class="method-heading">
206
- <a href="#M000028" class="method-signature">
207
+ <a href="#M000030" class="method-signature">
207
208
  <span class="method-name">each</span><span class="method-args">() {|[key, val]| ...}</span>
208
209
  </a>
209
210
  </div>
210
211
 
211
212
  <div class="method-description">
212
213
  <p><a class="source-toggle" href="#"
213
- onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
214
- <div class="method-source-code" id="M000028-source">
214
+ onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
215
+ <div class="method-source-code" id="M000030-source">
215
216
  <pre>
216
- <span class="ruby-comment cmt"># File lib/tenjin.rb, line 257</span>
217
+ <span class="ruby-comment cmt"># File lib/tenjin.rb, line 265</span>
217
218
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>()
218
219
  <span class="ruby-identifier">instance_variables</span>().<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
219
- <span class="ruby-identifier">val</span> = <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-identifier">name</span>)
220
- <span class="ruby-identifier">key</span> = <span class="ruby-identifier">name</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
221
- <span class="ruby-keyword kw">yield</span>([<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'@_buf'</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'@_engine'</span>
220
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'@_buf'</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'@_engine'</span>
221
+ <span class="ruby-identifier">val</span> = <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-identifier">name</span>)
222
+ <span class="ruby-identifier">key</span> = <span class="ruby-identifier">name</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
223
+ <span class="ruby-keyword kw">yield</span>([<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>])
224
+ <span class="ruby-keyword kw">end</span>
222
225
  <span class="ruby-keyword kw">end</span>
223
226
  <span class="ruby-keyword kw">end</span>
224
227
  </pre>
@@ -226,24 +229,38 @@ base class for <a href="Context.html">Context</a> class
226
229
  </div>
227
230
  </div>
228
231
 
229
- <div id="method-M000025" class="method-detail">
230
- <a name="M000025"></a>
232
+ <div id="method-M000029" class="method-detail">
233
+ <a name="M000029"></a>
231
234
 
232
235
  <div class="method-heading">
233
- <a href="#M000025" class="method-signature">
234
- <span class="method-name">escape</span><span class="method-args">(val)</span>
236
+ <span class="method-name">has_key?</span><span class="method-args">(key)</span>
237
+ </div>
238
+
239
+ <div class="method-description">
240
+ <p>
241
+ Alias for key?
242
+ </p>
243
+ </div>
244
+ </div>
245
+
246
+ <div id="method-M000028" class="method-detail">
247
+ <a name="M000028"></a>
248
+
249
+ <div class="method-heading">
250
+ <a href="#M000028" class="method-signature">
251
+ <span class="method-name">key?</span><span class="method-args">(key)</span>
235
252
  </a>
236
253
  </div>
237
254
 
238
255
  <div class="method-description">
239
256
  <p><a class="source-toggle" href="#"
240
- onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
241
- <div class="method-source-code" id="M000025-source">
257
+ onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
258
+ <div class="method-source-code" id="M000028-source">
242
259
  <pre>
243
- <span class="ruby-comment cmt"># File lib/tenjin.rb, line 243</span>
244
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">val</span>)
245
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">val</span>
246
- <span class="ruby-keyword kw">end</span>
260
+ <span class="ruby-comment cmt"># File lib/tenjin.rb, line 258</span>
261
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">key?</span>(<span class="ruby-identifier">key</span>)
262
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">instance_variable_defined?</span>(<span class="ruby-node">&quot;@#{key}&quot;</span>)
263
+ <span class="ruby-keyword kw">end</span>
247
264
  </pre>
248
265
  </div>
249
266
  </div>
@@ -263,7 +280,7 @@ base class for <a href="Context.html">Context</a> class
263
280
  onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
264
281
  <div class="method-source-code" id="M000027-source">
265
282
  <pre>
266
- <span class="ruby-comment cmt"># File lib/tenjin.rb, line 253</span>
283
+ <span class="ruby-comment cmt"># File lib/tenjin.rb, line 254</span>
267
284
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">key?</span>(<span class="ruby-identifier">key</span>)
268
285
  <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-node">&quot;@#{key}&quot;</span>)
269
286
  <span class="ruby-keyword kw">end</span>
@@ -286,7 +303,7 @@ base class for <a href="Context.html">Context</a> class
286
303
  onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
287
304
  <div class="method-source-code" id="M000026-source">
288
305
  <pre>
289
- <span class="ruby-comment cmt"># File lib/tenjin.rb, line 247</span>
306
+ <span class="ruby-comment cmt"># File lib/tenjin.rb, line 248</span>
290
307
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">hash</span>)
291
308
  <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
292
309
  <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">val</span>