tenjin 0.6.0 → 0.6.1
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/CHANGES.txt +46 -0
- data/MIT-LICENSE +1 -1
- data/README.txt +7 -7
- data/bin/rbtenjin +2 -2
- data/doc-api/classes/Tenjin.html +2 -2
- data/doc-api/classes/Tenjin/ArrayBufferTemplate.html +28 -28
- data/doc-api/classes/Tenjin/BaseContext.html +61 -44
- data/doc-api/classes/Tenjin/ContextHelper.html +85 -57
- data/doc-api/classes/Tenjin/Engine.html +88 -88
- data/doc-api/classes/Tenjin/ErubisTemplate.html +7 -7
- data/doc-api/classes/Tenjin/Preprocessor.html +28 -28
- data/doc-api/classes/Tenjin/Template.html +142 -142
- data/doc-api/created.rid +1 -1
- data/doc-api/files/README_txt.html +10 -10
- data/doc-api/files/lib/tenjin_rb.html +2 -2
- data/doc-api/fr_method_index.html +55 -53
- data/doc/examples.html +2 -2
- data/doc/faq.html +2 -2
- data/doc/users-guide.html +47 -4
- data/examples/form/Makefile +5 -0
- data/examples/form/Rakefile +7 -0
- data/examples/form/create.rbhtml +4 -0
- data/examples/form/form.rbhtml +14 -0
- data/examples/form/layout.rbhtml +8 -0
- data/examples/form/main.rb +9 -0
- data/examples/form/update.rbhtml +4 -0
- data/examples/preprocessing/Makefile +8 -0
- data/examples/preprocessing/Rakefile +11 -0
- data/examples/preprocessing/helper.rb +16 -0
- data/examples/preprocessing/main.rb +11 -0
- data/examples/preprocessing/select.rbhtml +15 -0
- data/examples/table/Makefile +5 -0
- data/examples/table/Rakefile +7 -0
- data/examples/table/table.rb +9 -0
- data/examples/table/table.rbhtml +16 -0
- data/lib/tenjin.rb +28 -18
- data/setup.rb +861 -607
- data/tenjin.gemspec +16 -12
- data/test/assert-text-equal.rb +2 -2
- data/test/data/users_guide/example16d.rb +27 -0
- data/test/data/users_guide/example16d.result +4 -0
- data/test/test_all.rb +2 -2
- data/test/test_engine.rb +2 -2
- data/test/test_examples.rb +2 -2
- data/test/test_faq.rb +2 -2
- data/test/test_htmlhelper.rb +2 -2
- data/test/test_main.rb +2 -2
- data/test/test_template.rb +2 -2
- data/test/test_users_guide.rb +2 -2
- data/test/testcase-helper.rb +2 -2
- metadata +64 -35
data/CHANGES.txt
ADDED
@@ -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
|
data/MIT-LICENSE
CHANGED
data/README.txt
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
= README
|
2
2
|
|
3
|
-
release:: 0.6.
|
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
|
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
|
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-
|
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-
|
41
|
-
$ cd rbtenjin-
|
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
|
|
data/bin/rbtenjin
CHANGED
@@ -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.
|
27
|
+
## $Release: 0.6.1 $
|
28
28
|
|
29
29
|
require 'tenjin'
|
30
30
|
|
data/doc-api/classes/Tenjin.html
CHANGED
@@ -77,7 +77,7 @@
|
|
77
77
|
<a href="Tenjin.html">Tenjin</a> module
|
78
78
|
</p>
|
79
79
|
<p>
|
80
|
-
$Rev:
|
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.
|
119
|
+
<td class="context-item-value">('$Release: 0.6.1 $' =~ /[\d.]+/) && $&</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="#
|
125
|
-
<a href="#
|
126
|
-
<a href="#
|
127
|
-
<a href="#
|
124
|
+
<a href="#M000019">expr_pattern</a>
|
125
|
+
<a href="#M000020">parse_exprs</a>
|
126
|
+
<a href="#M000022">quote_expr</a>
|
127
|
+
<a href="#M000021">quote_str</a>
|
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-
|
150
|
-
<a name="
|
149
|
+
<div id="method-M000019" class="method-detail">
|
150
|
+
<a name="M000019"></a>
|
151
151
|
|
152
152
|
<div class="method-heading">
|
153
|
-
<a href="#
|
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('
|
161
|
-
<div class="method-source-code" id="
|
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
|
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-
|
173
|
-
<a name="
|
172
|
+
<div id="method-M000020" class="method-detail">
|
173
|
+
<a name="M000020"></a>
|
174
174
|
|
175
175
|
<div class="method-heading">
|
176
|
-
<a href="#
|
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 (’#{…}’ and ’${…}’)
|
184
184
|
</p>
|
185
185
|
<p><a class="source-toggle" href="#"
|
186
|
-
onclick="toggleCode('
|
187
|
-
<div class="method-source-code" id="
|
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
|
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 (’#{…}’ and ’${…}’)
|
|
208
208
|
</div>
|
209
209
|
</div>
|
210
210
|
|
211
|
-
<div id="method-
|
212
|
-
<a name="
|
211
|
+
<div id="method-M000022" class="method-detail">
|
212
|
+
<a name="M000022"></a>
|
213
213
|
|
214
214
|
<div class="method-heading">
|
215
|
-
<a href="#
|
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('
|
223
|
-
<div class="method-source-code" id="
|
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
|
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">"#{@escapefunc}((#{expr}).to_s)"</span> <span class="ruby-operator">:</span> <span class="ruby-node">"(#{expr}).to_s"</span> <span class="ruby-comment cmt"># or "(#{expr})"</span>
|
228
228
|
<span class="ruby-keyword kw">end</span>
|
@@ -231,21 +231,21 @@ parse expressions (’#{…}’ and ’${…}’)
|
|
231
231
|
</div>
|
232
232
|
</div>
|
233
233
|
|
234
|
-
<div id="method-
|
235
|
-
<a name="
|
234
|
+
<div id="method-M000021" class="method-detail">
|
235
|
+
<a name="M000021"></a>
|
236
236
|
|
237
237
|
<div class="method-heading">
|
238
|
-
<a href="#
|
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('
|
246
|
-
<div class="method-source-code" id="
|
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
|
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">'\\\\\&'</span>)
|
251
251
|
<span class="ruby-keyword kw">return</span> <span class="ruby-node">"'#{text}'"</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="#
|
96
|
-
<a href="#
|
97
|
-
<a href="#
|
98
|
-
<a href="#
|
95
|
+
<a href="#M000024">[]</a>
|
96
|
+
<a href="#M000025">[]=</a>
|
97
|
+
<a href="#M000030">each</a>
|
98
|
+
<a href="#M000029">has_key?</a>
|
99
|
+
<a href="#M000028">key?</a>
|
99
100
|
<a href="#M000027">key?</a>
|
100
|
-
<a href="#
|
101
|
+
<a href="#M000023">new</a>
|
101
102
|
<a href="#M000026">update</a>
|
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-
|
132
|
-
<a name="
|
132
|
+
<div id="method-M000023" class="method-detail">
|
133
|
+
<a name="M000023"></a>
|
133
134
|
|
134
135
|
<div class="method-heading">
|
135
|
-
<a href="#
|
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('
|
143
|
-
<div class="method-source-code" id="
|
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
|
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-
|
157
|
-
<a name="
|
157
|
+
<div id="method-M000024" class="method-detail">
|
158
|
+
<a name="M000024"></a>
|
158
159
|
|
159
160
|
<div class="method-heading">
|
160
|
-
<a href="#
|
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('
|
168
|
-
<div class="method-source-code" id="
|
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
|
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">"@#{key}"</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-
|
180
|
-
<a name="
|
180
|
+
<div id="method-M000025" class="method-detail">
|
181
|
+
<a name="M000025"></a>
|
181
182
|
|
182
183
|
<div class="method-heading">
|
183
|
-
<a href="#
|
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('
|
191
|
-
<div class="method-source-code" id="
|
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
|
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">"@#{key}"</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-
|
203
|
-
<a name="
|
203
|
+
<div id="method-M000030" class="method-detail">
|
204
|
+
<a name="M000030"></a>
|
204
205
|
|
205
206
|
<div class="method-heading">
|
206
|
-
<a href="#
|
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('
|
214
|
-
<div class="method-source-code" id="
|
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
|
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">
|
220
|
-
|
221
|
-
|
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">&&</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-
|
230
|
-
<a name="
|
232
|
+
<div id="method-M000029" class="method-detail">
|
233
|
+
<a name="M000029"></a>
|
231
234
|
|
232
235
|
<div class="method-heading">
|
233
|
-
<
|
234
|
-
|
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('
|
241
|
-
<div class="method-source-code" id="
|
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
|
244
|
-
|
245
|
-
|
246
|
-
|
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">"@#{key}"</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
|
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">"@#{key}"</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
|
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>
|