kwartz 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/ChangeLog +36 -1
  2. data/LGPL +504 -0
  3. data/README.txt +16 -2
  4. data/bin/kwartz +1 -1
  5. data/doc-api/classes/Kwartz.html +47 -1
  6. data/doc-api/classes/Kwartz/Assertion.html +6 -6
  7. data/doc-api/classes/Kwartz/AssertionError.html +6 -6
  8. data/doc-api/classes/Kwartz/AttrInfo.html +42 -42
  9. data/doc-api/classes/Kwartz/BaseError.html +12 -12
  10. data/doc-api/classes/Kwartz/BaseTranslator.html +210 -43
  11. data/doc-api/classes/Kwartz/CharacterType.html +24 -24
  12. data/doc-api/classes/Kwartz/CommandOptionError.html +7 -7
  13. data/doc-api/classes/Kwartz/CommandOptions.html +49 -49
  14. data/doc-api/classes/Kwartz/Config.html +6 -1
  15. data/doc-api/classes/Kwartz/ConvertError.html +14 -14
  16. data/doc-api/classes/Kwartz/Converter.html +31 -30
  17. data/doc-api/classes/Kwartz/CssStyleParser.html +79 -57
  18. data/doc-api/classes/Kwartz/Defun.html +313 -0
  19. data/doc-api/classes/Kwartz/DocumentRuleset.html +58 -58
  20. data/doc-api/classes/Kwartz/ElementExpander.html +32 -32
  21. data/doc-api/classes/Kwartz/ElementInfo.html +29 -29
  22. data/doc-api/classes/Kwartz/ElementRuleset.html +126 -96
  23. data/doc-api/classes/Kwartz/EperlHandler.html +108 -84
  24. data/doc-api/classes/Kwartz/EperlTranslator.html +7 -7
  25. data/doc-api/classes/Kwartz/ErubisHandler.html +2 -2
  26. data/doc-api/classes/Kwartz/ErubisTranslator.html +8 -8
  27. data/doc-api/classes/Kwartz/ErubyHandler.html +2 -220
  28. data/doc-api/classes/Kwartz/ErubyTranslator.html +7 -7
  29. data/doc-api/classes/Kwartz/ExpandStatement.html +20 -20
  30. data/doc-api/classes/Kwartz/Handler.html +122 -117
  31. data/doc-api/classes/Kwartz/HandlerArgument.html +215 -0
  32. data/doc-api/classes/Kwartz/Helper.html +112 -0
  33. data/doc-api/classes/Kwartz/Helper/ActionViewHelper.html +221 -0
  34. data/doc-api/classes/Kwartz/Helper/RailsTemplate.html +630 -0
  35. data/doc-api/classes/Kwartz/JstlHandler.html +208 -193
  36. data/doc-api/classes/Kwartz/JstlTranslator.html +15 -15
  37. data/doc-api/classes/Kwartz/KwartzError.html +6 -6
  38. data/doc-api/classes/Kwartz/Main.html +39 -23
  39. data/doc-api/classes/Kwartz/NativeExpression.html +18 -18
  40. data/doc-api/classes/Kwartz/NativeStatement.html +25 -25
  41. data/doc-api/classes/Kwartz/Node.html +6 -6
  42. data/doc-api/classes/Kwartz/PIErubisHandler.html +113 -0
  43. data/doc-api/classes/Kwartz/PIErubisTranslator.html +200 -0
  44. data/doc-api/classes/Kwartz/ParseError.html +6 -6
  45. data/doc-api/classes/Kwartz/PhpHandler.html +102 -83
  46. data/doc-api/classes/Kwartz/PhpTranslator.html +14 -14
  47. data/doc-api/classes/Kwartz/PresentationLogicParser.html +136 -128
  48. data/doc-api/classes/Kwartz/PrintStatement.html +19 -19
  49. data/doc-api/classes/Kwartz/RailsHandler.html +121 -118
  50. data/doc-api/classes/Kwartz/RailsTranslator.html +7 -7
  51. data/doc-api/classes/Kwartz/RubyHandler.html +349 -0
  52. data/doc-api/classes/Kwartz/RubyStyleParser.html +85 -85
  53. data/doc-api/classes/Kwartz/RubyTranslator.html +218 -0
  54. data/doc-api/classes/Kwartz/StatementHelper.html +479 -0
  55. data/doc-api/classes/Kwartz/StrutsTranslator.html +12 -12
  56. data/doc-api/classes/Kwartz/TagInfo.html +28 -28
  57. data/doc-api/classes/Kwartz/TextConverter.html +28 -28
  58. data/doc-api/classes/Kwartz/Translator.html +42 -42
  59. data/doc-api/classes/Kwartz/Util.html +284 -0
  60. data/doc-api/created.rid +1 -1
  61. data/doc-api/files/__/README_txt.html +30 -3
  62. data/doc-api/files/kwartz/assert_rb.html +1 -1
  63. data/doc-api/files/kwartz/binding/eperl_rb.html +2 -2
  64. data/doc-api/files/kwartz/binding/erubis_rb.html +3 -3
  65. data/doc-api/files/kwartz/binding/eruby_rb.html +3 -2
  66. data/doc-api/files/kwartz/binding/jstl_rb.html +2 -2
  67. data/doc-api/files/kwartz/binding/php_rb.html +2 -2
  68. data/doc-api/files/kwartz/binding/pierubis_rb.html +116 -0
  69. data/doc-api/files/kwartz/binding/rails_rb.html +2 -2
  70. data/doc-api/files/kwartz/binding/ruby_rb.html +115 -0
  71. data/doc-api/files/kwartz/binding/struts_rb.html +1 -1
  72. data/doc-api/files/kwartz/config_rb.html +2 -2
  73. data/doc-api/files/kwartz/converter_rb.html +3 -2
  74. data/doc-api/files/kwartz/defun_rb.html +116 -0
  75. data/doc-api/files/kwartz/error_rb.html +1 -1
  76. data/doc-api/files/kwartz/helper/rails_rb.html +123 -0
  77. data/doc-api/files/kwartz/main_rb.html +5 -2
  78. data/doc-api/files/kwartz/node_rb.html +2 -2
  79. data/doc-api/files/kwartz/parser_rb.html +2 -2
  80. data/doc-api/files/kwartz/translator_rb.html +2 -2
  81. data/doc-api/files/kwartz/util/assert-text-equal_rb.html +1 -1
  82. data/doc-api/files/kwartz/util/testcase-helper_rb.html +2 -2
  83. data/doc-api/files/kwartz/util_rb.html +107 -0
  84. data/doc-api/files/kwartz_rb.html +3 -2
  85. data/doc-api/fr_class_index.html +11 -0
  86. data/doc-api/fr_file_index.html +5 -0
  87. data/doc-api/fr_method_index.html +242 -190
  88. data/doc/p-pattern.html +94 -94
  89. data/doc/reference.html +847 -612
  90. data/doc/users-guide.html +744 -241
  91. data/examples/rails1/README +2 -2
  92. data/examples/rails1/application_helper.rb +2 -27
  93. data/examples/rails1/link_to.plogic +5 -5
  94. data/examples/rails1/list.plogic +2 -2
  95. data/examples/rails2/app/controllers/application.rb +14 -0
  96. data/examples/rails2/app/controllers/groups_controller.rb +47 -0
  97. data/examples/rails2/app/controllers/members_controller.rb +56 -0
  98. data/examples/rails2/app/helpers/application_helper.rb +6 -0
  99. data/examples/rails2/app/helpers/groups_helper.rb +2 -0
  100. data/examples/rails2/app/helpers/members_helper.rb +2 -0
  101. data/examples/rails2/app/models/group.rb +2 -0
  102. data/examples/rails2/app/models/member.rb +3 -0
  103. data/examples/rails2/app/views/groups/_form.html +30 -0
  104. data/examples/rails2/app/views/groups/_form.plogic +11 -0
  105. data/examples/rails2/app/views/groups/_link.plogic +19 -0
  106. data/examples/rails2/app/views/groups/_read.plogic +7 -0
  107. data/examples/rails2/app/views/groups/edit.cfg.yaml +2 -0
  108. data/examples/rails2/app/views/groups/edit.html +26 -0
  109. data/examples/rails2/app/views/groups/edit.plogic +9 -0
  110. data/examples/rails2/app/views/groups/list.html +48 -0
  111. data/examples/rails2/app/views/groups/list.plogic +32 -0
  112. data/examples/rails2/app/views/groups/new.cfg.yaml +2 -0
  113. data/examples/rails2/app/views/groups/new.html +27 -0
  114. data/examples/rails2/app/views/groups/new.plogic +9 -0
  115. data/examples/rails2/app/views/groups/show.html +27 -0
  116. data/examples/rails2/app/views/groups/show.plogic +2 -0
  117. data/examples/rails2/app/views/layouts/groups.html +23 -0
  118. data/examples/rails2/app/views/layouts/groups.plogic +11 -0
  119. data/examples/rails2/app/views/layouts/members.html +23 -0
  120. data/examples/rails2/app/views/layouts/members.plogic +11 -0
  121. data/examples/rails2/app/views/layouts/members2.html +24 -0
  122. data/examples/rails2/app/views/layouts/members2.plogic +11 -0
  123. data/examples/rails2/app/views/members/_form.plogic +27 -0
  124. data/examples/rails2/app/views/members/_link.plogic +19 -0
  125. data/examples/rails2/app/views/members/_read.plogic +29 -0
  126. data/examples/rails2/app/views/members/edit.cfg.yaml +6 -0
  127. data/examples/rails2/app/views/members/edit.html +27 -0
  128. data/examples/rails2/app/views/members/edit.plogic +10 -0
  129. data/examples/rails2/app/views/members/list.html +53 -0
  130. data/examples/rails2/app/views/members/list.plogic +32 -0
  131. data/examples/rails2/app/views/members/new.html +61 -0
  132. data/examples/rails2/app/views/members/new.plogic +17 -0
  133. data/examples/rails2/app/views/members/show.html +41 -0
  134. data/examples/rails2/app/views/members/show.plogic +3 -0
  135. data/examples/rails2/db/create-tables.mysql.sql +27 -0
  136. data/examples/rails2/db/create-tables.pgsql.sql +27 -0
  137. data/examples/rails2/db/insert-data.sql +21 -0
  138. data/examples/rails2/db/tabledef.yaml +51 -0
  139. data/kwartz.gemspec +4 -4
  140. data/lib/kwartz.rb +10 -2
  141. data/lib/kwartz/assert.rb +1 -1
  142. data/lib/kwartz/binding/eperl.rb +85 -61
  143. data/lib/kwartz/binding/erubis.rb +6 -8
  144. data/lib/kwartz/binding/eruby.rb +5 -120
  145. data/lib/kwartz/binding/jstl.rb +116 -101
  146. data/lib/kwartz/binding/php.rb +79 -60
  147. data/lib/kwartz/binding/pierubis.rb +58 -0
  148. data/lib/kwartz/binding/rails.rb +45 -42
  149. data/lib/kwartz/binding/ruby.rb +193 -0
  150. data/lib/kwartz/binding/struts.rb +1 -1
  151. data/lib/kwartz/config.rb +4 -3
  152. data/lib/kwartz/converter.rb +231 -68
  153. data/lib/kwartz/defun.rb +126 -0
  154. data/lib/kwartz/error.rb +1 -1
  155. data/lib/kwartz/helper/rails.rb +437 -0
  156. data/lib/kwartz/main.rb +30 -38
  157. data/lib/kwartz/node.rb +46 -31
  158. data/lib/kwartz/parser.rb +43 -15
  159. data/lib/kwartz/translator.rb +104 -6
  160. data/lib/kwartz/util.rb +113 -0
  161. data/lib/kwartz/util/assert-text-equal.rb +1 -1
  162. data/lib/kwartz/util/testcase-helper.rb +26 -8
  163. data/test/test-compile.rb +3 -3
  164. data/test/test-compile.yaml +135 -5
  165. data/test/test-converter.rb +16 -8
  166. data/test/test-converter.yaml +307 -76
  167. data/test/test-directives.rb +1 -1
  168. data/test/test-directives.yaml +964 -979
  169. data/test/test-main.rb +61 -146
  170. data/test/test-main.yaml +235 -0
  171. data/test/test-parser.rb +10 -12
  172. data/test/test-parser.yaml +484 -326
  173. data/test/test-rails.rb +1 -1
  174. data/test/test-rails.yaml +37 -37
  175. data/test/test-ruleset.rb +1 -1
  176. data/test/test-ruleset.yaml +34 -40
  177. data/test/test.rb +1 -1
  178. metadata +82 -3
  179. data/COPYING +0 -340
@@ -0,0 +1,284 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Kwartz::Util</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Kwartz::Util</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/kwartz/util_rb.html">
59
+ kwartz/util.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000023">intern_hash_keys</a>&nbsp;&nbsp;
84
+ <a href="#M000024">pattern_to_regexp</a>&nbsp;&nbsp;
85
+ <a href="#M000025">select_with_patterns</a>&nbsp;&nbsp;
86
+ <a href="#M000022">untabify</a>&nbsp;&nbsp;
87
+ </div>
88
+ </div>
89
+
90
+ </div>
91
+
92
+
93
+ <!-- if includes -->
94
+
95
+ <div id="section">
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ <!-- if method_list -->
105
+ <div id="methods">
106
+ <h3 class="section-bar">Public Instance methods</h3>
107
+
108
+ <div id="method-M000023" class="method-detail">
109
+ <a name="M000023"></a>
110
+
111
+ <div class="method-heading">
112
+ <a href="#M000023" class="method-signature">
113
+ <span class="method-name">intern_hash_keys</span><span class="method-args">(obj, done={})</span>
114
+ </a>
115
+ </div>
116
+
117
+ <div class="method-description">
118
+ <p>
119
+ convert hash&#8217;s key string into symbol.
120
+ </p>
121
+ <p>
122
+ ex.
123
+ </p>
124
+ <pre>
125
+ hash = YAML.load_file('foo.yaml')
126
+ intern_hash_keys(hash)
127
+ </pre>
128
+ <p><a class="source-toggle" href="#"
129
+ onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
130
+ <div class="method-source-code" id="M000023-source">
131
+ <pre>
132
+ <span class="ruby-comment cmt"># File kwartz/util.rb, line 51</span>
133
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">intern_hash_keys</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">done</span>={})
134
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">done</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">__id__</span>)
135
+ <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">obj</span>
136
+ <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Hash</span>
137
+ <span class="ruby-identifier">done</span>[<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">__id__</span>] = <span class="ruby-identifier">obj</span>
138
+ <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">keys</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-operator">|</span>
139
+ <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">intern</span>] = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
140
+ <span class="ruby-keyword kw">end</span>
141
+ <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
142
+ <span class="ruby-identifier">intern_hash_keys</span>(<span class="ruby-identifier">val</span>, <span class="ruby-identifier">done</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
143
+ <span class="ruby-keyword kw">end</span>
144
+ <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span>
145
+ <span class="ruby-identifier">done</span>[<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">__id__</span>] = <span class="ruby-identifier">obj</span>
146
+ <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
147
+ <span class="ruby-identifier">intern_hash_keys</span>(<span class="ruby-identifier">val</span>, <span class="ruby-identifier">done</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
148
+ <span class="ruby-keyword kw">end</span>
149
+ <span class="ruby-keyword kw">end</span>
150
+ <span class="ruby-keyword kw">end</span>
151
+ </pre>
152
+ </div>
153
+ </div>
154
+ </div>
155
+
156
+ <div id="method-M000024" class="method-detail">
157
+ <a name="M000024"></a>
158
+
159
+ <div class="method-heading">
160
+ <a href="#M000024" class="method-signature">
161
+ <span class="method-name">pattern_to_regexp</span><span class="method-args">(pattern)</span>
162
+ </a>
163
+ </div>
164
+
165
+ <div class="method-description">
166
+ <p>
167
+ convert string pattern into regexp. metacharacter &#8217;*&#8217; and
168
+ &#8217;?&#8217; are available.
169
+ </p>
170
+ <p>
171
+ ex.
172
+ </p>
173
+ <pre>
174
+ pattern_to_regexp('*.html') #=&gt; /\A(.*)\.html\z/
175
+ </pre>
176
+ <p><a class="source-toggle" href="#"
177
+ onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
178
+ <div class="method-source-code" id="M000024-source">
179
+ <pre>
180
+ <span class="ruby-comment cmt"># File kwartz/util.rb, line 78</span>
181
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pattern_to_regexp</span>(<span class="ruby-identifier">pattern</span>)
182
+ <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
183
+ <span class="ruby-identifier">len</span> = <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">length</span>
184
+ <span class="ruby-identifier">s</span> = <span class="ruby-value str">'\A'</span>
185
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">len</span>
186
+ <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">ch</span> = <span class="ruby-identifier">pattern</span>[<span class="ruby-identifier">i</span>]
187
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value">?\\</span> ; <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">pattern</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span>].<span class="ruby-identifier">chr</span>)
188
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value">?*</span> ; <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'(.*)'</span>
189
+ <span class="ruby-keyword kw">when</span> <span class="ruby-value">??</span> ; <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'(.)'</span>
190
+ <span class="ruby-keyword kw">else</span> ; <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">ch</span>.<span class="ruby-identifier">chr</span>)
191
+ <span class="ruby-keyword kw">end</span>
192
+ <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
193
+ <span class="ruby-keyword kw">end</span>
194
+ <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'\z'</span>
195
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">compile</span>(<span class="ruby-identifier">s</span>)
196
+ <span class="ruby-keyword kw">end</span>
197
+ </pre>
198
+ </div>
199
+ </div>
200
+ </div>
201
+
202
+ <div id="method-M000025" class="method-detail">
203
+ <a name="M000025"></a>
204
+
205
+ <div class="method-heading">
206
+ <a href="#M000025" class="method-signature">
207
+ <span class="method-name">select_with_patterns</span><span class="method-args">(list, patterns)</span>
208
+ </a>
209
+ </div>
210
+
211
+ <div class="method-description">
212
+ <p>
213
+ select items from list with patterns.
214
+ </p>
215
+ <p>
216
+ ex.
217
+ </p>
218
+ <pre>
219
+ patterns = %w[user_*]
220
+ names = %w[user_name user_age error_msg]
221
+ select_with_patterns(list, patterns) #=&gt; ['user_name', 'user_age']
222
+ </pre>
223
+ <p><a class="source-toggle" href="#"
224
+ onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
225
+ <div class="method-source-code" id="M000025-source">
226
+ <pre>
227
+ <span class="ruby-comment cmt"># File kwartz/util.rb, line 104</span>
228
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">select_with_patterns</span>(<span class="ruby-identifier">list</span>, <span class="ruby-identifier">patterns</span>)
229
+ <span class="ruby-identifier">regexp_list</span> = <span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">pattern</span><span class="ruby-operator">|</span> <span class="ruby-identifier">pattern_to_regexp</span>(<span class="ruby-identifier">pattern</span>) }
230
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">list</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">regexp_list</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">rexp</span><span class="ruby-operator">|</span> <span class="ruby-identifier">rexp</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">item</span> } }
231
+ <span class="ruby-keyword kw">end</span>
232
+ </pre>
233
+ </div>
234
+ </div>
235
+ </div>
236
+
237
+ <div id="method-M000022" class="method-detail">
238
+ <a name="M000022"></a>
239
+
240
+ <div class="method-heading">
241
+ <a href="#M000022" class="method-signature">
242
+ <span class="method-name">untabify</span><span class="method-args">(str, width=8)</span>
243
+ </a>
244
+ </div>
245
+
246
+ <div class="method-description">
247
+ <p>
248
+ expand tab characters to spaces
249
+ </p>
250
+ <p><a class="source-toggle" href="#"
251
+ onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
252
+ <div class="method-source-code" id="M000022-source">
253
+ <pre>
254
+ <span class="ruby-comment cmt"># File kwartz/util.rb, line 20</span>
255
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">untabify</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">width</span>=<span class="ruby-value">8</span>)
256
+ <span class="ruby-identifier">list</span> = <span class="ruby-identifier">str</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\t/</span>)
257
+ <span class="ruby-identifier">last</span> = <span class="ruby-identifier">list</span>.<span class="ruby-identifier">pop</span>
258
+ <span class="ruby-identifier">buf</span> = []
259
+ <span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
260
+ <span class="ruby-identifier">column</span> = (<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">rindex</span>(<span class="ruby-value">?\n</span>)) <span class="ruby-operator">?</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">pos</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">length</span>
261
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">width</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">column</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">width</span>)
262
+ <span class="ruby-identifier">buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
263
+ <span class="ruby-keyword kw">end</span>
264
+ <span class="ruby-identifier">buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">last</span>
265
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">join</span>
266
+ <span class="ruby-keyword kw">end</span>
267
+ </pre>
268
+ </div>
269
+ </div>
270
+ </div>
271
+
272
+
273
+ </div>
274
+
275
+
276
+ </div>
277
+
278
+
279
+ <div id="validator-badges">
280
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
281
+ </div>
282
+
283
+ </body>
284
+ </html>
@@ -1 +1 @@
1
- Thu Jun 01 08:26:18 JST 2006
1
+ Sun Sep 24 20:08:59 JST 2006
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Wed May 31 18:30:28 JST 2006</td>
59
+ <td>Sat Sep 23 21:11:03 JST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -71,7 +71,7 @@
71
71
  <div id="description">
72
72
  <h1>README</h1>
73
73
  <table>
74
- <tr><td valign="top">release:</td><td>$Release: 3.0.0 $
74
+ <tr><td valign="top">release:</td><td>$Release: 3.1.0 $
75
75
 
76
76
  </td></tr>
77
77
  <tr><td valign="top">copyright:</td><td>copyright(c) 2004-2006 kuwata-lab.com all rights reserved
@@ -107,7 +107,7 @@ Else download kwartz-ruby_x.x.x.tar.bz2 and install with setup.rb.
107
107
  </pre>
108
108
  <h2>Copyright</h2>
109
109
  <p>
110
- GPL v.2
110
+ LGPL 2.1
111
111
  </p>
112
112
  <p>
113
113
  If you need looser license, please suggest me.
@@ -115,6 +115,33 @@ If you need looser license, please suggest me.
115
115
  <p>
116
116
  Output scripts kwartz command generates are outside of the license.
117
117
  </p>
118
+ <h2>Special Thanks</h2>
119
+ <ul>
120
+ <li>This project is subsidized by Exploratory Software Project of IPA
121
+ (Information-Technology Promotion Agency Japan). See <a
122
+ href="http://www.ipa.go.jp/about/english/index.html">www.ipa.go.jp/about/english/index.html</a>
123
+ for IPA.
124
+
125
+ </li>
126
+ <li>Some people gave me advices. Thank you!
127
+
128
+ <ul>
129
+ <li>Shu-yu Guo - He corrected my English of documents.
130
+
131
+ </li>
132
+ <li>Andreas Schwarz - He gave me several good advices.
133
+
134
+ </li>
135
+ <li>Wesley J Landaker - He created a Debian package of <a
136
+ href="../../classes/Kwartz.html">Kwartz</a>.
137
+
138
+ </li>
139
+ <li>S.Yamanaka - He gave me good suggestions.
140
+
141
+ </li>
142
+ </ul>
143
+ </li>
144
+ </ul>
118
145
 
119
146
  </div>
120
147
 
@@ -70,7 +70,7 @@
70
70
 
71
71
  <div id="description">
72
72
  <p>
73
- $Rev: 103 $ $Release: 3.0.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights reserved
73
+ $Rev: 103 $ $Release: 3.1.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights reserved
74
74
  </p>
75
75
 
76
76
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Wed May 31 11:16:45 JST 2006</td>
59
+ <td>Tue Jun 06 01:18:00 JST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -70,7 +70,7 @@
70
70
 
71
71
  <div id="description">
72
72
  <p>
73
- $Rev: 117 $ $Release: 3.0.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights reserved
73
+ $Rev: 123 $ $Release: 3.1.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights reserved
74
74
  </p>
75
75
 
76
76
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri May 12 09:54:02 JST 2006</td>
59
+ <td>Mon Aug 07 00:31:42 JST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -70,7 +70,7 @@
70
70
 
71
71
  <div id="description">
72
72
  <p>
73
- $Rev: 110 $ $Release: 3.0.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights reserved
73
+ $Rev: 124 $ $Release: 3.1.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights reserved
74
74
  </p>
75
75
 
76
76
  </div>
@@ -81,7 +81,7 @@ $Rev: 110 $ $Release: 3.0.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights r
81
81
  <div class="name-list">
82
82
  <a href="../converter_rb.html">kwartz/converter</a>&nbsp;&nbsp;
83
83
  <a href="../translator_rb.html">kwartz/translator</a>&nbsp;&nbsp;
84
- <a href="eruby_rb.html">kwartz/binding/eruby</a>&nbsp;&nbsp;
84
+ <a href="ruby_rb.html">kwartz/binding/ruby</a>&nbsp;&nbsp;
85
85
  </div>
86
86
  </div>
87
87
 
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Sat May 13 13:00:12 JST 2006</td>
59
+ <td>Mon Aug 07 00:31:42 JST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -70,7 +70,7 @@
70
70
 
71
71
  <div id="description">
72
72
  <p>
73
- $Rev: 111 $ $Release: 3.0.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights reserved
73
+ $Rev: 124 $ $Release: 3.1.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights reserved
74
74
  </p>
75
75
 
76
76
  </div>
@@ -81,6 +81,7 @@ $Rev: 111 $ $Release: 3.0.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights r
81
81
  <div class="name-list">
82
82
  <a href="../converter_rb.html">kwartz/converter</a>&nbsp;&nbsp;
83
83
  <a href="../translator_rb.html">kwartz/translator</a>&nbsp;&nbsp;
84
+ <a href="ruby_rb.html">kwartz/binding/ruby</a>&nbsp;&nbsp;
84
85
  </div>
85
86
  </div>
86
87
 
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri May 26 21:51:16 JST 2006</td>
59
+ <td>Tue Jun 06 01:18:01 JST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -70,7 +70,7 @@
70
70
 
71
71
  <div id="description">
72
72
  <p>
73
- $Rev: 116 $ $Release: 3.0.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights reserved
73
+ $Rev: 123 $ $Release: 3.1.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights reserved
74
74
  </p>
75
75
 
76
76
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri May 26 21:51:17 JST 2006</td>
59
+ <td>Tue Jun 06 01:18:01 JST 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -70,7 +70,7 @@
70
70
 
71
71
  <div id="description">
72
72
  <p>
73
- $Rev: 116 $ $Release: 3.0.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights reserved
73
+ $Rev: 123 $ $Release: 3.1.0 $ copyright(c) 2004-2006 kuwata-lab.com all rights reserved
74
74
  </p>
75
75
 
76
76
  </div>