kwartz 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +340 -0
- data/ChangeLog +103 -0
- data/README.txt +37 -0
- data/bin/kwartz +12 -0
- data/doc-api/classes/Kwartz.html +218 -0
- data/doc-api/classes/Kwartz/Assertion.html +140 -0
- data/doc-api/classes/Kwartz/AssertionError.html +148 -0
- data/doc-api/classes/Kwartz/AttrInfo.html +320 -0
- data/doc-api/classes/Kwartz/BaseError.html +206 -0
- data/doc-api/classes/Kwartz/BaseTranslator.html +331 -0
- data/doc-api/classes/Kwartz/CharacterType.html +212 -0
- data/doc-api/classes/Kwartz/CommandOptionError.html +154 -0
- data/doc-api/classes/Kwartz/CommandOptions.html +374 -0
- data/doc-api/classes/Kwartz/Config.html +150 -0
- data/doc-api/classes/Kwartz/ConvertError.html +191 -0
- data/doc-api/classes/Kwartz/Converter.html +252 -0
- data/doc-api/classes/Kwartz/CssStyleParser.html +483 -0
- data/doc-api/classes/Kwartz/DocumentRuleset.html +369 -0
- data/doc-api/classes/Kwartz/ElementExpander.html +325 -0
- data/doc-api/classes/Kwartz/ElementInfo.html +312 -0
- data/doc-api/classes/Kwartz/ElementRuleset.html +582 -0
- data/doc-api/classes/Kwartz/EperlHandler.html +338 -0
- data/doc-api/classes/Kwartz/EperlTranslator.html +167 -0
- data/doc-api/classes/Kwartz/ErubisHandler.html +113 -0
- data/doc-api/classes/Kwartz/ErubisTranslator.html +168 -0
- data/doc-api/classes/Kwartz/ErubyHandler.html +337 -0
- data/doc-api/classes/Kwartz/ErubyTranslator.html +167 -0
- data/doc-api/classes/Kwartz/ExpandStatement.html +227 -0
- data/doc-api/classes/Kwartz/Expression.html +119 -0
- data/doc-api/classes/Kwartz/Handler.html +558 -0
- data/doc-api/classes/Kwartz/JstlHandler.html +657 -0
- data/doc-api/classes/Kwartz/JstlTranslator.html +226 -0
- data/doc-api/classes/Kwartz/KwartzError.html +146 -0
- data/doc-api/classes/Kwartz/Main.html +384 -0
- data/doc-api/classes/Kwartz/NativeExpression.html +236 -0
- data/doc-api/classes/Kwartz/NativeStatement.html +254 -0
- data/doc-api/classes/Kwartz/Node.html +156 -0
- data/doc-api/classes/Kwartz/ParseError.html +148 -0
- data/doc-api/classes/Kwartz/PhpHandler.html +333 -0
- data/doc-api/classes/Kwartz/PhpTranslator.html +194 -0
- data/doc-api/classes/Kwartz/PresentationLogicParser.html +830 -0
- data/doc-api/classes/Kwartz/PrintStatement.html +221 -0
- data/doc-api/classes/Kwartz/RailsHandler.html +587 -0
- data/doc-api/classes/Kwartz/RailsTranslator.html +167 -0
- data/doc-api/classes/Kwartz/RubyStyleParser.html +558 -0
- data/doc-api/classes/Kwartz/Ruleset.html +117 -0
- data/doc-api/classes/Kwartz/Statement.html +119 -0
- data/doc-api/classes/Kwartz/StrutsTranslator.html +190 -0
- data/doc-api/classes/Kwartz/TagInfo.html +314 -0
- data/doc-api/classes/Kwartz/TextConverter.html +270 -0
- data/doc-api/classes/Kwartz/Translator.html +318 -0
- data/doc-api/classes/Test.html +107 -0
- data/doc-api/classes/Test/Unit.html +101 -0
- data/doc-api/created.rid +1 -0
- data/doc-api/files/__/README_txt.html +150 -0
- data/doc-api/files/kwartz/assert_rb.html +114 -0
- data/doc-api/files/kwartz/binding/eperl_rb.html +116 -0
- data/doc-api/files/kwartz/binding/erubis_rb.html +116 -0
- data/doc-api/files/kwartz/binding/eruby_rb.html +115 -0
- data/doc-api/files/kwartz/binding/jstl_rb.html +116 -0
- data/doc-api/files/kwartz/binding/php_rb.html +116 -0
- data/doc-api/files/kwartz/binding/rails_rb.html +115 -0
- data/doc-api/files/kwartz/binding/struts_rb.html +117 -0
- data/doc-api/files/kwartz/config_rb.html +107 -0
- data/doc-api/files/kwartz/converter_rb.html +119 -0
- data/doc-api/files/kwartz/error_rb.html +107 -0
- data/doc-api/files/kwartz/main_rb.html +124 -0
- data/doc-api/files/kwartz/node_rb.html +114 -0
- data/doc-api/files/kwartz/parser_rb.html +117 -0
- data/doc-api/files/kwartz/translator_rb.html +115 -0
- data/doc-api/files/kwartz/util/assert-text-equal_rb.html +115 -0
- data/doc-api/files/kwartz/util/testcase-helper_rb.html +115 -0
- data/doc-api/files/kwartz_rb.html +120 -0
- data/doc-api/fr_class_index.html +75 -0
- data/doc-api/fr_file_index.html +45 -0
- data/doc-api/fr_method_index.html +216 -0
- data/doc-api/index.html +24 -0
- data/doc-api/rdoc-style.css +208 -0
- data/doc/docstyle.css +188 -0
- data/doc/p-pattern.html +1207 -0
- data/doc/reference.html +3396 -0
- data/doc/users-guide.html +1670 -0
- data/examples/breadcrumbs1/Makefile +15 -0
- data/examples/breadcrumbs1/breadcrumbs.eruby.plogic +27 -0
- data/examples/breadcrumbs1/breadcrumbs.html +12 -0
- data/examples/breadcrumbs1/breadcrumbs.jstl.plogic +28 -0
- data/examples/breadcrumbs1/breadcrumbs.php.plogic +26 -0
- data/examples/breadcrumbs1/main.php +12 -0
- data/examples/breadcrumbs1/main.rb +12 -0
- data/examples/breadcrumbs2/Makefile +15 -0
- data/examples/breadcrumbs2/breadcrumbs.eruby.plogic +22 -0
- data/examples/breadcrumbs2/breadcrumbs.html +14 -0
- data/examples/breadcrumbs2/breadcrumbs.jstl.plogic +24 -0
- data/examples/breadcrumbs2/breadcrumbs.php.plogic +23 -0
- data/examples/breadcrumbs2/main.php +12 -0
- data/examples/breadcrumbs2/main.rb +12 -0
- data/examples/pagelayout/Makefile +47 -0
- data/examples/pagelayout/content.eruby.plogic +44 -0
- data/examples/pagelayout/content.jstl.plogic +36 -0
- data/examples/pagelayout/content.php.plogic +37 -0
- data/examples/pagelayout/content1.html +36 -0
- data/examples/pagelayout/content2.html +29 -0
- data/examples/pagelayout/design.css +40 -0
- data/examples/pagelayout/layout.html +50 -0
- data/examples/pagelayout/main.php +55 -0
- data/examples/pagelayout/main.rb +77 -0
- data/examples/pagelayout/menu.eruby.plogic +14 -0
- data/examples/pagelayout/menu.html +13 -0
- data/examples/pagelayout/menu.jstl.plogic +14 -0
- data/examples/pagelayout/menu.php.plogic +14 -0
- data/examples/rails1/Makefile +36 -0
- data/examples/rails1/README +19 -0
- data/examples/rails1/application_helper.rb +31 -0
- data/examples/rails1/edit.html +28 -0
- data/examples/rails1/edit.plogic +10 -0
- data/examples/rails1/form.html +52 -0
- data/examples/rails1/form.plogic +33 -0
- data/examples/rails1/layout.plogic +15 -0
- data/examples/rails1/link_to.plogic +19 -0
- data/examples/rails1/list.html +48 -0
- data/examples/rails1/list.plogic +28 -0
- data/examples/rails1/new.html +27 -0
- data/examples/rails1/new.plogic +10 -0
- data/examples/rails1/reader.plogic +29 -0
- data/examples/rails1/show.html +40 -0
- data/examples/rails1/show.plogic +4 -0
- data/examples/rails1/writer.plogic +8 -0
- data/examples/table1/Makefile +15 -0
- data/examples/table1/main.php +11 -0
- data/examples/table1/main.rb +11 -0
- data/examples/table1/table1.eruby.plogic +21 -0
- data/examples/table1/table1.html +16 -0
- data/examples/table1/table1.jstl.plogic +21 -0
- data/examples/table1/table1.php.plogic +22 -0
- data/kwartz.gemspec +55 -0
- data/lib/kwartz.rb +13 -0
- data/lib/kwartz/assert.rb +31 -0
- data/lib/kwartz/binding/eperl.rb +166 -0
- data/lib/kwartz/binding/erubis.rb +61 -0
- data/lib/kwartz/binding/eruby.rb +164 -0
- data/lib/kwartz/binding/jstl.rb +334 -0
- data/lib/kwartz/binding/php.rb +167 -0
- data/lib/kwartz/binding/rails.rb +295 -0
- data/lib/kwartz/binding/struts.rb +109 -0
- data/lib/kwartz/config.rb +28 -0
- data/lib/kwartz/converter.rb +920 -0
- data/lib/kwartz/error.rb +41 -0
- data/lib/kwartz/main.rb +464 -0
- data/lib/kwartz/node.rb +454 -0
- data/lib/kwartz/parser.rb +903 -0
- data/lib/kwartz/translator.rb +153 -0
- data/lib/kwartz/util/assert-text-equal.rb +44 -0
- data/lib/kwartz/util/testcase-helper.rb +112 -0
- data/setup.rb +1331 -0
- data/test/test-compile.rb +36 -0
- data/test/test-compile.yaml +178 -0
- data/test/test-converter.rb +34 -0
- data/test/test-converter.yaml +127 -0
- data/test/test-directives.rb +32 -0
- data/test/test-directives.yaml +1411 -0
- data/test/test-main.rb +464 -0
- data/test/test-parser.rb +54 -0
- data/test/test-parser.yaml +394 -0
- data/test/test-rails.rb +28 -0
- data/test/test-rails.yaml +301 -0
- data/test/test-ruleset.rb +36 -0
- data/test/test-ruleset.yaml +804 -0
- data/test/test.rb +44 -0
- metadata +236 -0
@@ -0,0 +1,154 @@
|
|
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>Class: Kwartz::CommandOptionError</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>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Kwartz::CommandOptionError</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/kwartz/main_rb.html">
|
59
|
+
kwartz/main.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="KwartzError.html">
|
69
|
+
KwartzError
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
command option error class
|
86
|
+
</p>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<div id="method-list">
|
94
|
+
<h3 class="section-bar">Methods</h3>
|
95
|
+
|
96
|
+
<div class="name-list">
|
97
|
+
<a href="#M000149">new</a>
|
98
|
+
</div>
|
99
|
+
</div>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
<!-- if includes -->
|
105
|
+
|
106
|
+
<div id="section">
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<!-- if method_list -->
|
116
|
+
<div id="methods">
|
117
|
+
<h3 class="section-bar">Public Class methods</h3>
|
118
|
+
|
119
|
+
<div id="method-M000149" class="method-detail">
|
120
|
+
<a name="M000149"></a>
|
121
|
+
|
122
|
+
<div class="method-heading">
|
123
|
+
<a href="#M000149" class="method-signature">
|
124
|
+
<span class="method-name">new</span><span class="method-args">(message)</span>
|
125
|
+
</a>
|
126
|
+
</div>
|
127
|
+
|
128
|
+
<div class="method-description">
|
129
|
+
<p><a class="source-toggle" href="#"
|
130
|
+
onclick="toggleCode('M000149-source');return false;">[Source]</a></p>
|
131
|
+
<div class="method-source-code" id="M000149-source">
|
132
|
+
<pre>
|
133
|
+
<span class="ruby-comment cmt"># File kwartz/main.rb, line 28</span>
|
134
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">message</span>)
|
135
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">message</span>)
|
136
|
+
<span class="ruby-keyword kw">end</span>
|
137
|
+
</pre>
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
</div>
|
147
|
+
|
148
|
+
|
149
|
+
<div id="validator-badges">
|
150
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
</body>
|
154
|
+
</html>
|
@@ -0,0 +1,374 @@
|
|
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>Class: Kwartz::CommandOptions</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>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Kwartz::CommandOptions</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/kwartz/main_rb.html">
|
59
|
+
kwartz/main.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
command option class
|
84
|
+
</p>
|
85
|
+
<p>
|
86
|
+
ex.
|
87
|
+
</p>
|
88
|
+
<pre>
|
89
|
+
option_table = [
|
90
|
+
[?h, :help, nil],
|
91
|
+
[?v, :version, nil],
|
92
|
+
[?f, :file, "filename"],
|
93
|
+
]
|
94
|
+
properties = {}
|
95
|
+
options = CommandOption.new(option_table, properties)
|
96
|
+
filenames = options.parse_argv(ARGV)
|
97
|
+
p options.help
|
98
|
+
p options.version
|
99
|
+
p options.file
|
100
|
+
</pre>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<div id="method-list">
|
108
|
+
<h3 class="section-bar">Methods</h3>
|
109
|
+
|
110
|
+
<div class="name-list">
|
111
|
+
<a href="#M000143">[]</a>
|
112
|
+
<a href="#M000144">[]=</a>
|
113
|
+
<a href="#M000146">char</a>
|
114
|
+
<a href="#M000147">chr</a>
|
115
|
+
<a href="#M000145">key?</a>
|
116
|
+
<a href="#M000142">new</a>
|
117
|
+
<a href="#M000148">parse_argv</a>
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
<!-- if includes -->
|
125
|
+
|
126
|
+
<div id="section">
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<!-- if method_list -->
|
136
|
+
<div id="methods">
|
137
|
+
<h3 class="section-bar">Public Class methods</h3>
|
138
|
+
|
139
|
+
<div id="method-M000142" class="method-detail">
|
140
|
+
<a name="M000142"></a>
|
141
|
+
|
142
|
+
<div class="method-heading">
|
143
|
+
<a href="#M000142" class="method-signature">
|
144
|
+
<span class="method-name">new</span><span class="method-args">(option_table, properties={})</span>
|
145
|
+
</a>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
<div class="method-description">
|
149
|
+
<p><a class="source-toggle" href="#"
|
150
|
+
onclick="toggleCode('M000142-source');return false;">[Source]</a></p>
|
151
|
+
<div class="method-source-code" id="M000142-source">
|
152
|
+
<pre>
|
153
|
+
<span class="ruby-comment cmt"># File kwartz/main.rb, line 54</span>
|
154
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">option_table</span>, <span class="ruby-identifier">properties</span>={})
|
155
|
+
<span class="ruby-ivar">@_option_table</span> = <span class="ruby-identifier">option_table</span>
|
156
|
+
<span class="ruby-ivar">@_properties</span> = <span class="ruby-identifier">properties</span>
|
157
|
+
<span class="ruby-identifier">buf</span> = []
|
158
|
+
<span class="ruby-identifier">optchars</span> = {}
|
159
|
+
<span class="ruby-identifier">option_table</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">char</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">argname</span><span class="ruby-operator">|</span>
|
160
|
+
<span class="ruby-identifier">buf</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"def #{key}; @#{key}; end; def #{key}=(val); @#{key}=val; end\n"</span>
|
161
|
+
<span class="ruby-keyword kw">end</span>
|
162
|
+
<span class="ruby-identifier">instance_eval</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">join</span>
|
163
|
+
<span class="ruby-keyword kw">end</span>
|
164
|
+
</pre>
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
170
|
+
|
171
|
+
<div id="method-M000143" class="method-detail">
|
172
|
+
<a name="M000143"></a>
|
173
|
+
|
174
|
+
<div class="method-heading">
|
175
|
+
<a href="#M000143" class="method-signature">
|
176
|
+
<span class="method-name">[]</span><span class="method-args">(key)</span>
|
177
|
+
</a>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
<div class="method-description">
|
181
|
+
<p><a class="source-toggle" href="#"
|
182
|
+
onclick="toggleCode('M000143-source');return false;">[Source]</a></p>
|
183
|
+
<div class="method-source-code" id="M000143-source">
|
184
|
+
<pre>
|
185
|
+
<span class="ruby-comment cmt"># File kwartz/main.rb, line 75</span>
|
186
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
|
187
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Fixnum</span>)
|
188
|
+
<span class="ruby-identifier">entry</span> = <span class="ruby-identifier">_find_entry</span>(<span class="ruby-identifier">key</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">return</span>
|
189
|
+
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">entry</span>[<span class="ruby-value">1</span>]
|
190
|
+
<span class="ruby-keyword kw">end</span>
|
191
|
+
<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-node">"@#{key}"</span>)
|
192
|
+
<span class="ruby-keyword kw">end</span>
|
193
|
+
</pre>
|
194
|
+
</div>
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
<div id="method-M000144" class="method-detail">
|
199
|
+
<a name="M000144"></a>
|
200
|
+
|
201
|
+
<div class="method-heading">
|
202
|
+
<a href="#M000144" class="method-signature">
|
203
|
+
<span class="method-name">[]=</span><span class="method-args">(key, val)</span>
|
204
|
+
</a>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div class="method-description">
|
208
|
+
<p><a class="source-toggle" href="#"
|
209
|
+
onclick="toggleCode('M000144-source');return false;">[Source]</a></p>
|
210
|
+
<div class="method-source-code" id="M000144-source">
|
211
|
+
<pre>
|
212
|
+
<span class="ruby-comment cmt"># File kwartz/main.rb, line 83</span>
|
213
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>)
|
214
|
+
<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">"@#{key}"</span>, <span class="ruby-identifier">val</span>)
|
215
|
+
<span class="ruby-keyword kw">end</span>
|
216
|
+
</pre>
|
217
|
+
</div>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<div id="method-M000146" class="method-detail">
|
222
|
+
<a name="M000146"></a>
|
223
|
+
|
224
|
+
<div class="method-heading">
|
225
|
+
<a href="#M000146" class="method-signature">
|
226
|
+
<span class="method-name">char</span><span class="method-args">(key)</span>
|
227
|
+
</a>
|
228
|
+
</div>
|
229
|
+
|
230
|
+
<div class="method-description">
|
231
|
+
<p><a class="source-toggle" href="#"
|
232
|
+
onclick="toggleCode('M000146-source');return false;">[Source]</a></p>
|
233
|
+
<div class="method-source-code" id="M000146-source">
|
234
|
+
<pre>
|
235
|
+
<span class="ruby-comment cmt"># File kwartz/main.rb, line 91</span>
|
236
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">char</span>(<span class="ruby-identifier">key</span>)
|
237
|
+
<span class="ruby-identifier">entry</span> = <span class="ruby-identifier">_find_entry</span>(<span class="ruby-identifier">key</span>)
|
238
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">entry</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">entry</span>[<span class="ruby-value">0</span>]
|
239
|
+
<span class="ruby-keyword kw">end</span>
|
240
|
+
</pre>
|
241
|
+
</div>
|
242
|
+
</div>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<div id="method-M000147" class="method-detail">
|
246
|
+
<a name="M000147"></a>
|
247
|
+
|
248
|
+
<div class="method-heading">
|
249
|
+
<a href="#M000147" class="method-signature">
|
250
|
+
<span class="method-name">chr</span><span class="method-args">(key)</span>
|
251
|
+
</a>
|
252
|
+
</div>
|
253
|
+
|
254
|
+
<div class="method-description">
|
255
|
+
<p><a class="source-toggle" href="#"
|
256
|
+
onclick="toggleCode('M000147-source');return false;">[Source]</a></p>
|
257
|
+
<div class="method-source-code" id="M000147-source">
|
258
|
+
<pre>
|
259
|
+
<span class="ruby-comment cmt"># File kwartz/main.rb, line 96</span>
|
260
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">chr</span>(<span class="ruby-identifier">key</span>)
|
261
|
+
<span class="ruby-identifier">ch</span> = <span class="ruby-identifier">char</span>(<span class="ruby-identifier">key</span>)
|
262
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ch</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">ch</span>.<span class="ruby-identifier">chr</span> <span class="ruby-operator">:</span> <span class="ruby-value str">''</span>
|
263
|
+
<span class="ruby-keyword kw">end</span>
|
264
|
+
</pre>
|
265
|
+
</div>
|
266
|
+
</div>
|
267
|
+
</div>
|
268
|
+
|
269
|
+
<div id="method-M000145" class="method-detail">
|
270
|
+
<a name="M000145"></a>
|
271
|
+
|
272
|
+
<div class="method-heading">
|
273
|
+
<a href="#M000145" class="method-signature">
|
274
|
+
<span class="method-name">key?</span><span class="method-args">(key)</span>
|
275
|
+
</a>
|
276
|
+
</div>
|
277
|
+
|
278
|
+
<div class="method-description">
|
279
|
+
<p><a class="source-toggle" href="#"
|
280
|
+
onclick="toggleCode('M000145-source');return false;">[Source]</a></p>
|
281
|
+
<div class="method-source-code" id="M000145-source">
|
282
|
+
<pre>
|
283
|
+
<span class="ruby-comment cmt"># File kwartz/main.rb, line 87</span>
|
284
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">key?</span>(<span class="ruby-identifier">key</span>)
|
285
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-node">"@#{key}"</span>)
|
286
|
+
<span class="ruby-keyword kw">end</span>
|
287
|
+
</pre>
|
288
|
+
</div>
|
289
|
+
</div>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
<div id="method-M000148" class="method-detail">
|
293
|
+
<a name="M000148"></a>
|
294
|
+
|
295
|
+
<div class="method-heading">
|
296
|
+
<a href="#M000148" class="method-signature">
|
297
|
+
<span class="method-name">parse_argv</span><span class="method-args">(argv)</span>
|
298
|
+
</a>
|
299
|
+
</div>
|
300
|
+
|
301
|
+
<div class="method-description">
|
302
|
+
<p><a class="source-toggle" href="#"
|
303
|
+
onclick="toggleCode('M000148-source');return false;">[Source]</a></p>
|
304
|
+
<div class="method-source-code" id="M000148-source">
|
305
|
+
<pre>
|
306
|
+
<span class="ruby-comment cmt"># File kwartz/main.rb, line 101</span>
|
307
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_argv</span>(<span class="ruby-identifier">argv</span>)
|
308
|
+
<span class="ruby-identifier">properties</span> = <span class="ruby-ivar">@_properties</span>
|
309
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-operator">!</span><span class="ruby-identifier">argv</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">argv</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?-</span>
|
310
|
+
<span class="ruby-identifier">optstr</span> = <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">shift</span>
|
311
|
+
<span class="ruby-identifier">optstr</span> = <span class="ruby-identifier">optstr</span>[<span class="ruby-value">1</span>, <span class="ruby-identifier">optstr</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
|
312
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">optstr</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?-</span> <span class="ruby-comment cmt"># properties</span>
|
313
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">optstr</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A-([-\w]+)(?:=(.*))?/</span>
|
314
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">option_error</span>(<span class="ruby-node">"'-#{optstr}': invalid property pattern."</span>)
|
315
|
+
<span class="ruby-keyword kw">end</span>
|
316
|
+
<span class="ruby-identifier">pname</span> = <span class="ruby-identifier">$1</span> ; <span class="ruby-identifier">pvalue</span> = <span class="ruby-identifier">$2</span>
|
317
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">pvalue</span>
|
318
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span> ; <span class="ruby-identifier">pvalue</span> = <span class="ruby-keyword kw">true</span>
|
319
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\A\d+\z/</span> ; <span class="ruby-identifier">pvalue</span> = <span class="ruby-identifier">pvalue</span>.<span class="ruby-identifier">to_i</span>
|
320
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\A\d+\.\d+\z/</span> ; <span class="ruby-identifier">pvalue</span> = <span class="ruby-identifier">pvalue</span>.<span class="ruby-identifier">to_f</span>
|
321
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'true'</span>, <span class="ruby-value str">'yes'</span>, <span class="ruby-value str">'on'</span> ; <span class="ruby-identifier">pvalue</span> = <span class="ruby-keyword kw">true</span>
|
322
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'false'</span>, <span class="ruby-value str">'no'</span>, <span class="ruby-value str">'off'</span> ; <span class="ruby-identifier">pvalue</span> = <span class="ruby-keyword kw">false</span>
|
323
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'nil'</span>, <span class="ruby-value str">'null'</span> ; <span class="ruby-identifier">pvalue</span> = <span class="ruby-keyword kw">nil</span>
|
324
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\A'.*'\z/</span>, <span class="ruby-regexp re">/\A".*"\z/</span> ; <span class="ruby-identifier">pvalue</span> = <span class="ruby-identifier">eval</span> <span class="ruby-identifier">pvalue</span>
|
325
|
+
<span class="ruby-keyword kw">end</span>
|
326
|
+
<span class="ruby-identifier">properties</span>[<span class="ruby-identifier">pname</span>.<span class="ruby-identifier">intern</span>] = <span class="ruby-identifier">pvalue</span>
|
327
|
+
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># command-line options</span>
|
328
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-identifier">optstr</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">optstr</span>.<span class="ruby-identifier">empty?</span>
|
329
|
+
<span class="ruby-identifier">optchar</span> = <span class="ruby-identifier">optstr</span>[<span class="ruby-value">0</span>]
|
330
|
+
<span class="ruby-identifier">optstr</span> = <span class="ruby-identifier">optstr</span>[<span class="ruby-value">1</span>, <span class="ruby-identifier">optstr</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
|
331
|
+
<span class="ruby-identifier">entry</span> = <span class="ruby-identifier">_find_entry</span>(<span class="ruby-identifier">optchar</span>)
|
332
|
+
<span class="ruby-identifier">entry</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">CommandOptionError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"-#{optchar.chr}: unknown option."</span>)
|
333
|
+
<span class="ruby-identifier">char</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">argname</span> = <span class="ruby-identifier">entry</span>
|
334
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">argname</span>
|
335
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">false</span>
|
336
|
+
<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">"@#{key}"</span>, <span class="ruby-keyword kw">true</span>)
|
337
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>
|
338
|
+
<span class="ruby-identifier">arg</span> = <span class="ruby-identifier">optstr</span>
|
339
|
+
<span class="ruby-identifier">arg</span> = <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">shift</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">arg</span>.<span class="ruby-identifier">empty?</span>
|
340
|
+
<span class="ruby-identifier">arg</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">CommandOptionError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"-#{optchar.chr}: #{argname} required."</span>)
|
341
|
+
<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">"@#{key}"</span>, <span class="ruby-identifier">arg</span>)
|
342
|
+
<span class="ruby-identifier">optstr</span> = <span class="ruby-value str">''</span>
|
343
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">true</span>
|
344
|
+
<span class="ruby-identifier">arg</span> = <span class="ruby-identifier">optstr</span>
|
345
|
+
<span class="ruby-identifier">arg</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">arg</span>.<span class="ruby-identifier">empty?</span>
|
346
|
+
<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">"@#{key}"</span>, <span class="ruby-identifier">arg</span>)
|
347
|
+
<span class="ruby-identifier">optstr</span> = <span class="ruby-value str">''</span>
|
348
|
+
<span class="ruby-keyword kw">else</span>
|
349
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"** internal error **"</span>
|
350
|
+
<span class="ruby-keyword kw">end</span>
|
351
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#while</span>
|
352
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#if</span>
|
353
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#while</span>
|
354
|
+
<span class="ruby-identifier">filenames</span> = <span class="ruby-identifier">argv</span>
|
355
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">filenames</span>
|
356
|
+
<span class="ruby-keyword kw">end</span>
|
357
|
+
</pre>
|
358
|
+
</div>
|
359
|
+
</div>
|
360
|
+
</div>
|
361
|
+
|
362
|
+
|
363
|
+
</div>
|
364
|
+
|
365
|
+
|
366
|
+
</div>
|
367
|
+
|
368
|
+
|
369
|
+
<div id="validator-badges">
|
370
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
371
|
+
</div>
|
372
|
+
|
373
|
+
</body>
|
374
|
+
</html>
|