optiflag 0.6 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/ReleaseNotes.txt +35 -0
- data/doc/classes/OptiFlag.html +439 -0
- data/doc/classes/OptiFlag.src/M000001.html +49 -0
- data/doc/classes/OptiFlag.src/M000002.html +49 -0
- data/doc/classes/OptiFlag.src/M000003.html +30 -0
- data/doc/classes/OptiFlag/Flagset.html +459 -0
- data/doc/classes/OptiFlag/Flagset.src/M000003.html +45 -0
- data/doc/classes/OptiFlag/Flagset.src/M000004.html +45 -0
- data/doc/classes/OptiFlag/Flagset.src/M000005.html +18 -0
- data/doc/classes/OptiFlag/Flagset.src/M000006.html +20 -0
- data/doc/classes/OptiFlag/Flagset.src/M000007.html +35 -0
- data/doc/classes/OptiFlag/Flagset.src/M000008.html +23 -0
- data/doc/classes/OptiFlag/Flagset.src/M000009.html +24 -0
- data/doc/classes/OptiFlag/Flagset.src/M000010.html +28 -0
- data/doc/classes/OptiFlag/Flagset.src/M000011.html +20 -0
- data/doc/classes/OptiFlag/Flagset.src/M000012.html +24 -0
- data/doc/classes/OptiFlag/Flagset.src/M000013.html +24 -0
- data/doc/classes/OptiFlag/Flagset.src/M000014.html +32 -0
- data/doc/classes/OptiFlag/Flagset.src/M000015.html +25 -0
- data/doc/classes/OptiFlag/Flagset.src/M000016.html +53 -0
- data/doc/classes/OptiFlag/Flagset.src/M000017.html +53 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.html +930 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000024.html +36 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000025.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000026.html +36 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000027.html +36 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000028.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000029.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000030.html +19 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000031.html +19 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000032.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000033.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000034.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000035.html +22 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000036.html +19 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000037.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000038.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000039.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000040.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000041.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000042.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000043.html +19 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000044.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000045.html +19 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000046.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000047.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000048.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000049.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000050.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000051.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000052.html +20 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000053.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000054.html +18 -0
- data/doc/classes/OptiFlag/Flagset/EachFlag.src/M000055.html +22 -0
- data/doc/classes/OptiFlag/Flagset/Errors.html +192 -0
- data/doc/classes/OptiFlag/Flagset/Errors.src/M000021.html +18 -0
- data/doc/classes/OptiFlag/Flagset/Errors.src/M000022.html +19 -0
- data/doc/classes/OptiFlag/Flagset/Errors.src/M000023.html +18 -0
- data/doc/classes/OptiFlag/Flagset/Errors.src/M000024.html +18 -0
- data/doc/classes/OptiFlag/Flagset/Errors.src/M000025.html +19 -0
- data/doc/classes/OptiFlag/Flagset/Errors.src/M000026.html +36 -0
- data/doc/classes/OptiFlag/Flagset/Help.html +125 -0
- data/doc/classes/OptiFlag/Flagset/Help/Bundle.html +160 -0
- data/doc/classes/OptiFlag/Flagset/Help/Bundle.src/M000018.html +18 -0
- data/doc/classes/OptiFlag/Flagset/Help/Bundle.src/M000019.html +18 -0
- data/doc/classes/OptiFlag/Flagset/Help/StandardHelpBundle.html +118 -0
- data/doc/classes/OptiFlag/Flagset/NewInterface.html +296 -0
- data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000017.html +18 -0
- data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000018.html +18 -0
- data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000019.html +18 -0
- data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000020.html +18 -0
- data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000021.html +18 -0
- data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000022.html +18 -0
- data/doc/classes/OptiFlag/Flagset/NewInterface.src/M000023.html +18 -0
- data/doc/created.rid +1 -0
- data/doc/files/optiflag-help_rb.html +101 -0
- data/doc/files/optiflag-parse_rb.html +101 -0
- data/doc/files/optiflag_rb.html +167 -0
- data/doc/files/optiflag_rb.src/M000001.html +18 -0
- data/doc/fr_class_index.html +34 -0
- data/doc/fr_file_index.html +29 -0
- data/doc/fr_method_index.html +82 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/examples/example_1.rb +21 -0
- data/examples/example_1_1.rb +21 -0
- data/{doc/example → examples}/example_1_2.rb +8 -8
- data/examples/example_2.rb +31 -0
- data/{doc/example → examples}/example_2_1.rb +4 -4
- data/{doc/example → examples}/example_2_2.rb +7 -5
- data/{doc/example → examples}/example_2_3.rb +9 -9
- data/{doc/example → examples}/example_2_4.rb +4 -4
- data/{doc/example → examples}/example_2_5.rb +4 -4
- data/{doc/example → examples}/example_2_6.rb +6 -6
- data/{doc/example → examples}/example_3.rb +7 -6
- data/examples/example_6.rb +20 -0
- data/{doc/example → examples}/example_7.rb +5 -4
- data/examples/example_8.rb +26 -0
- data/optiflag-help.rb +42 -0
- data/optiflag-parse.rb +281 -0
- data/optiflag.gemspec +4 -3
- data/optiflag.rb +972 -0
- data/quick.rb +12 -0
- data/{test → testcases}/tc_advanced_usage_helping.rb +4 -0
- data/{test → testcases}/tc_basic_alternate_forms.rb +0 -0
- data/{test → testcases}/tc_basic_char_flags.rb +12 -12
- data/{test → testcases}/tc_basic_optional_flag.rb +0 -0
- data/{test → testcases}/tc_basic_parsing.rb +0 -0
- data/{test → testcases}/tc_basic_usage_helping.rb +0 -0
- data/{test → testcases}/tc_basic_value_validation.rb +0 -0
- data/{test → testcases}/tc_bug_one.rb +0 -0
- data/{test → testcases}/tc_bug_two.rb +0 -0
- data/{test → testcases}/tc_change_symbols.rb +0 -0
- data/{test → testcases}/tc_enumerated_value_validation.rb +0 -0
- data/{test → testcases}/tc_flagall.rb +4 -0
- data/{test → testcases}/tc_flagless_arg.rb +0 -0
- data/{test → testcases}/tc_keyword.rb +0 -0
- data/testcases/tc_new_basic_parsing.rb +51 -0
- data/testcases/tc_poro_tester.rb +30 -0
- data/{test → testcases}/tc_values_as_hash.rb +0 -0
- metadata +152 -52
- data/doc/example/example_1.rb +0 -30
- data/doc/example/example_1_1.rb +0 -27
- data/doc/example/example_2.rb +0 -28
- data/doc/example/example_4.rb +0 -12
- data/doc/example/example_5.rb +0 -26
- data/doc/example/example_6.rb +0 -17
- data/lib/optiflag.rb +0 -860
@@ -0,0 +1,49 @@
|
|
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>
|
7
|
+
<head>
|
8
|
+
<title>using_object (OptiFlag)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File optiflag.rb, line 575</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">OptiFlag</span>.<span class="ruby-identifier">using_object</span>(<span class="ruby-identifier">a_single_object</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">the_block</span>)
|
15
|
+
<span class="ruby-identifier">class_hierarchy</span> = [<span class="ruby-identifier">a_single_object</span>.<span class="ruby-identifier">class</span>]
|
16
|
+
<span class="ruby-identifier">clazz</span> = <span class="ruby-identifier">a_single_object</span>.<span class="ruby-identifier">class</span>
|
17
|
+
<span class="ruby-keyword kw">begin</span>
|
18
|
+
<span class="ruby-identifier">clazz</span> = <span class="ruby-identifier">clazz</span>.<span class="ruby-identifier">superclass</span>
|
19
|
+
<span class="ruby-identifier">class_hierarchy</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">clazz</span>
|
20
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">clazz</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Object</span>
|
21
|
+
<span class="ruby-identifier">potential_methods</span> =
|
22
|
+
<span class="ruby-identifier">class_hierarchy</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">instance_methods</span>(<span class="ruby-keyword kw">false</span>)}.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">sort</span>
|
23
|
+
|
24
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">'enumerator'</span>
|
25
|
+
<span class="ruby-identifier">valid_instance_var</span> = []
|
26
|
+
<span class="ruby-identifier">potential_opt_switch_flags</span>, <span class="ruby-identifier">potential_methods</span> =
|
27
|
+
<span class="ruby-identifier">potential_methods</span>.<span class="ruby-identifier">partition</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\?$/</span> }
|
28
|
+
<span class="ruby-identifier">potential_methods</span>.<span class="ruby-identifier">each_slice</span>(<span class="ruby-value">2</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">getter</span>,<span class="ruby-identifier">setter</span><span class="ruby-operator">|</span>
|
29
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">setter</span> <span class="ruby-operator">==</span> (<span class="ruby-identifier">getter</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"="</span>)
|
30
|
+
<span class="ruby-identifier">valid_instance_var</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">getter</span>,<span class="ruby-identifier">setter</span>];
|
31
|
+
<span class="ruby-keyword kw">end</span>
|
32
|
+
<span class="ruby-keyword kw">end</span>
|
33
|
+
<span class="ruby-identifier">mod</span> = <span class="ruby-constant">Module</span>.<span class="ruby-identifier">new</span>
|
34
|
+
<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">Flagset</span>
|
35
|
+
<span class="ruby-identifier">valid_instance_var</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">getter</span>,<span class="ruby-identifier">setter</span><span class="ruby-operator">|</span>
|
36
|
+
<span class="ruby-identifier">bound_method</span> = <span class="ruby-identifier">a_single_object</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">setter</span>)
|
37
|
+
<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-keyword kw">do</span>
|
38
|
+
<span class="ruby-identifier">flag</span> <span class="ruby-identifier">getter</span> <span class="ruby-keyword kw">do</span>
|
39
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">proxied_bound_method</span> = <span class="ruby-identifier">bound_method</span>
|
40
|
+
<span class="ruby-keyword kw">end</span>
|
41
|
+
<span class="ruby-keyword kw">end</span>
|
42
|
+
<span class="ruby-keyword kw">end</span>
|
43
|
+
<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-operator">&</span><span class="ruby-identifier">the_block</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">the_block</span>
|
44
|
+
<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-keyword kw">do</span>
|
45
|
+
<span class="ruby-identifier">handle_errors_and_help</span>
|
46
|
+
<span class="ruby-keyword kw">end</span>
|
47
|
+
<span class="ruby-keyword kw">end</span></pre>
|
48
|
+
</body>
|
49
|
+
</html>
|
@@ -0,0 +1,49 @@
|
|
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>
|
7
|
+
<head>
|
8
|
+
<title>using_object (OptiFlag)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File optiflag.rb, line 575</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">OptiFlag</span>.<span class="ruby-identifier">using_object</span>(<span class="ruby-identifier">a_single_object</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">the_block</span>)
|
15
|
+
<span class="ruby-identifier">class_hierarchy</span> = [<span class="ruby-identifier">a_single_object</span>.<span class="ruby-identifier">class</span>]
|
16
|
+
<span class="ruby-identifier">clazz</span> = <span class="ruby-identifier">a_single_object</span>.<span class="ruby-identifier">class</span>
|
17
|
+
<span class="ruby-keyword kw">begin</span>
|
18
|
+
<span class="ruby-identifier">clazz</span> = <span class="ruby-identifier">clazz</span>.<span class="ruby-identifier">superclass</span>
|
19
|
+
<span class="ruby-identifier">class_hierarchy</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">clazz</span>
|
20
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">clazz</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Object</span>
|
21
|
+
<span class="ruby-identifier">potential_methods</span> =
|
22
|
+
<span class="ruby-identifier">class_hierarchy</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">instance_methods</span>(<span class="ruby-keyword kw">false</span>)}.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">sort</span>
|
23
|
+
|
24
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">'enumerator'</span>
|
25
|
+
<span class="ruby-identifier">valid_instance_var</span> = []
|
26
|
+
<span class="ruby-identifier">potential_opt_switch_flags</span>, <span class="ruby-identifier">potential_methods</span> =
|
27
|
+
<span class="ruby-identifier">potential_methods</span>.<span class="ruby-identifier">partition</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\?$/</span> }
|
28
|
+
<span class="ruby-identifier">potential_methods</span>.<span class="ruby-identifier">each_slice</span>(<span class="ruby-value">2</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">getter</span>,<span class="ruby-identifier">setter</span><span class="ruby-operator">|</span>
|
29
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">setter</span> <span class="ruby-operator">==</span> (<span class="ruby-identifier">getter</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"="</span>)
|
30
|
+
<span class="ruby-identifier">valid_instance_var</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">getter</span>,<span class="ruby-identifier">setter</span>];
|
31
|
+
<span class="ruby-keyword kw">end</span>
|
32
|
+
<span class="ruby-keyword kw">end</span>
|
33
|
+
<span class="ruby-identifier">mod</span> = <span class="ruby-constant">Module</span>.<span class="ruby-identifier">new</span>
|
34
|
+
<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">Flagset</span>
|
35
|
+
<span class="ruby-identifier">valid_instance_var</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">getter</span>,<span class="ruby-identifier">setter</span><span class="ruby-operator">|</span>
|
36
|
+
<span class="ruby-identifier">bound_method</span> = <span class="ruby-identifier">a_single_object</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">setter</span>)
|
37
|
+
<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-keyword kw">do</span>
|
38
|
+
<span class="ruby-identifier">flag</span> <span class="ruby-identifier">getter</span> <span class="ruby-keyword kw">do</span>
|
39
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">proxied_bound_method</span> = <span class="ruby-identifier">bound_method</span>
|
40
|
+
<span class="ruby-keyword kw">end</span>
|
41
|
+
<span class="ruby-keyword kw">end</span>
|
42
|
+
<span class="ruby-keyword kw">end</span>
|
43
|
+
<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-operator">&</span><span class="ruby-identifier">the_block</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">the_block</span>
|
44
|
+
<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-keyword kw">do</span>
|
45
|
+
<span class="ruby-identifier">handle_errors_and_help</span>
|
46
|
+
<span class="ruby-keyword kw">end</span>
|
47
|
+
<span class="ruby-keyword kw">end</span></pre>
|
48
|
+
</body>
|
49
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
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>
|
7
|
+
<head>
|
8
|
+
<title>Flagset (OptiFlag)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File optiflag.rb, line 661</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">OptiFlag</span>.<span class="ruby-constant">Flagset</span>(<span class="ruby-identifier">hash</span>)
|
15
|
+
<span class="ruby-comment cmt"># changed this from just returning Flagset...</span>
|
16
|
+
<span class="ruby-comment cmt"># Reason Being: a user can specify two modules in one file</span>
|
17
|
+
<span class="ruby-comment cmt"># one with this method, and one just using Flagset...</span>
|
18
|
+
<span class="ruby-comment cmt"># if you don't clone at this point, you are left with </span>
|
19
|
+
<span class="ruby-comment cmt"># a global change... BUT to get the cloning working</span>
|
20
|
+
<span class="ruby-comment cmt"># I had to do some singleton_class trickeration as part of</span>
|
21
|
+
<span class="ruby-comment cmt"># the initialize method for EachFlag... I am not </span>
|
22
|
+
<span class="ruby-comment cmt"># 100% sure I understand what I just did. -- D.O.E 5/30/06</span>
|
23
|
+
<span class="ruby-identifier">mod</span> = <span class="ruby-constant">Flagset</span>.<span class="ruby-identifier">clone</span>
|
24
|
+
<span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">symb</span>,<span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
|
25
|
+
<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">symb</span>.<span class="ruby-identifier">to_sym</span>,<span class="ruby-identifier">val</span>)
|
26
|
+
<span class="ruby-keyword kw">end</span>
|
27
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">mod</span>
|
28
|
+
<span class="ruby-keyword kw">end</span></pre>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,459 @@
|
|
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: OptiFlag::Flagset</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">OptiFlag::Flagset</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/optiflag-help_rb.html">
|
59
|
+
optiflag-help.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../../files/optiflag-parse_rb.html">
|
63
|
+
optiflag-parse.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
<a href="../../files/optiflag_rb.html">
|
67
|
+
optiflag.rb
|
68
|
+
</a>
|
69
|
+
<br />
|
70
|
+
</td>
|
71
|
+
</tr>
|
72
|
+
|
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
|
+
testing to see if this shows (2)
|
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="#M000018">and_process!</a>
|
98
|
+
<a href="#M000014">character_flag</a>
|
99
|
+
<a href="#M000013">extended_help_flag</a>
|
100
|
+
<a href="#M000007">flag</a>
|
101
|
+
<a href="#M000015">flag_properties</a>
|
102
|
+
<a href="#M000005">flag_symbol</a>
|
103
|
+
<a href="#M000011">flagless_arg</a>
|
104
|
+
<a href="#M000017">handle_errors_and_help</a>
|
105
|
+
<a href="#M000006">increment_order_counter</a>
|
106
|
+
<a href="#M000010">keyword</a>
|
107
|
+
<a href="#M000008">optional_flag</a>
|
108
|
+
<a href="#M000009">optional_switch_flag</a>
|
109
|
+
<a href="#M000004">parse</a>
|
110
|
+
<a href="#M000016">properties</a>
|
111
|
+
<a href="#M000012">usage_flag</a>
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
<!-- if includes -->
|
119
|
+
|
120
|
+
<div id="section">
|
121
|
+
|
122
|
+
<div id="class-list">
|
123
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
124
|
+
|
125
|
+
Module <a href="Flagset/Help.html" class="link">OptiFlag::Flagset::Help</a><br />
|
126
|
+
Module <a href="Flagset/NewInterface.html" class="link">OptiFlag::Flagset::NewInterface</a><br />
|
127
|
+
Class <a href="Flagset/EachFlag.html" class="link">OptiFlag::Flagset::EachFlag</a><br />
|
128
|
+
Class <a href="Flagset/Errors.html" class="link">OptiFlag::Flagset::Errors</a><br />
|
129
|
+
|
130
|
+
</div>
|
131
|
+
|
132
|
+
<div id="constants-list">
|
133
|
+
<h3 class="section-bar">Constants</h3>
|
134
|
+
|
135
|
+
<div class="name-list">
|
136
|
+
<table summary="Constants">
|
137
|
+
<tr class="top-aligned-row context-row">
|
138
|
+
<td class="context-item-name">STANDARD_EXTENDED_HELP</td>
|
139
|
+
<td>=</td>
|
140
|
+
<td class="context-item-value">proc do |render_on,short,long,dash_short,dash_long,required_or_not,description,arity,alternate_forms,name| render_on.puts "----------------"</td>
|
141
|
+
</tr>
|
142
|
+
</table>
|
143
|
+
</div>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<div id="attribute-list">
|
149
|
+
<h3 class="section-bar">Attributes</h3>
|
150
|
+
|
151
|
+
<div class="name-list">
|
152
|
+
<table>
|
153
|
+
<tr class="top-aligned-row context-row">
|
154
|
+
<td class="context-item-name">dash_symbol</td>
|
155
|
+
<td class="context-item-value"> [R] </td>
|
156
|
+
<td class="context-item-desc"></td>
|
157
|
+
</tr>
|
158
|
+
<tr class="top-aligned-row context-row">
|
159
|
+
<td class="context-item-name">help_bundle</td>
|
160
|
+
<td class="context-item-value"> [RW] </td>
|
161
|
+
<td class="context-item-desc"></td>
|
162
|
+
</tr>
|
163
|
+
</table>
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<!-- if method_list -->
|
170
|
+
<div id="methods">
|
171
|
+
<h3 class="section-bar">Public Class methods</h3>
|
172
|
+
|
173
|
+
<div id="method-M000005" class="method-detail">
|
174
|
+
<a name="M000005"></a>
|
175
|
+
|
176
|
+
<div class="method-heading">
|
177
|
+
<a href="Flagset.src/M000005.html" target="Code" class="method-signature"
|
178
|
+
onclick="popupCode('Flagset.src/M000005.html');return false;">
|
179
|
+
<span class="method-name">flag_symbol</span><span class="method-args">(val)</span>
|
180
|
+
</a>
|
181
|
+
</div>
|
182
|
+
|
183
|
+
<div class="method-description">
|
184
|
+
<p>
|
185
|
+
method called by ‘send’ using a hash of values, the key being
|
186
|
+
the name of the method (this method) and the value being the parameter to
|
187
|
+
be passed to the method. Therefore,
|
188
|
+
</p>
|
189
|
+
<pre>
|
190
|
+
module Example extend OptiFlagSet(:flag_symbol => "/")
|
191
|
+
</pre>
|
192
|
+
<p>
|
193
|
+
is invoking this method ‘<a
|
194
|
+
href="Flagset.html#M000005">flag_symbol</a>’ and passing the value
|
195
|
+
"/" as the parameter. See the RDoc for the <b>method</b>
|
196
|
+
‘<a href="Flagset.html">OptiFlag::Flagset</a>()’ in the <a
|
197
|
+
href="../OptiFlag.html">OptiFlag</a> module, <b>not</b> the module <a
|
198
|
+
href="Flagset.html">OptiFlag::Flagset</a> which it resembles.
|
199
|
+
</p>
|
200
|
+
<p>
|
201
|
+
This method, when invoked using the above expression changes the default <a
|
202
|
+
href="Flagset.html#M000007">flag</a> symbol from "-" to whatever
|
203
|
+
is passed in. Thus, if we wanted to simulate the MSDos flags, we would use:
|
204
|
+
</p>
|
205
|
+
<pre>
|
206
|
+
module Example extend OptiFlagSet(:flag_symbol => "/")
|
207
|
+
</pre>
|
208
|
+
<p>
|
209
|
+
which would then <a href="Flagset.html#M000004">parse</a> a command line
|
210
|
+
looking like:
|
211
|
+
</p>
|
212
|
+
<pre>
|
213
|
+
/h /renew /username daniel /password fluffy
|
214
|
+
</pre>
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
<div id="method-M000006" class="method-detail">
|
219
|
+
<a name="M000006"></a>
|
220
|
+
|
221
|
+
<div class="method-heading">
|
222
|
+
<a href="Flagset.src/M000006.html" target="Code" class="method-signature"
|
223
|
+
onclick="popupCode('Flagset.src/M000006.html');return false;">
|
224
|
+
<span class="method-name">increment_order_counter</span><span class="method-args">()</span>
|
225
|
+
</a>
|
226
|
+
</div>
|
227
|
+
|
228
|
+
<div class="method-description">
|
229
|
+
</div>
|
230
|
+
</div>
|
231
|
+
|
232
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
233
|
+
|
234
|
+
<div id="method-M000018" class="method-detail">
|
235
|
+
<a name="M000018"></a>
|
236
|
+
|
237
|
+
<div class="method-heading">
|
238
|
+
<span class="method-name">and_process!</span><span class="method-args">(level=:not_strict)</span>
|
239
|
+
</div>
|
240
|
+
|
241
|
+
<div class="method-description">
|
242
|
+
<p>
|
243
|
+
Alias for <a href="Flagset.html#M000017">handle_errors_and_help</a>
|
244
|
+
</p>
|
245
|
+
</div>
|
246
|
+
</div>
|
247
|
+
|
248
|
+
<div id="method-M000014" class="method-detail">
|
249
|
+
<a name="M000014"></a>
|
250
|
+
|
251
|
+
<div class="method-heading">
|
252
|
+
<a href="Flagset.src/M000014.html" target="Code" class="method-signature"
|
253
|
+
onclick="popupCode('Flagset.src/M000014.html');return false;">
|
254
|
+
<span class="method-name">character_flag</span><span class="method-args">(switch,group="default",&the_block)</span>
|
255
|
+
</a>
|
256
|
+
</div>
|
257
|
+
|
258
|
+
<div class="method-description">
|
259
|
+
<p>
|
260
|
+
top-level <a href="Flagset.html#M000007">flag</a>-declarer
|
261
|
+
</p>
|
262
|
+
</div>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
<div id="method-M000013" class="method-detail">
|
266
|
+
<a name="M000013"></a>
|
267
|
+
|
268
|
+
<div class="method-heading">
|
269
|
+
<a href="Flagset.src/M000013.html" target="Code" class="method-signature"
|
270
|
+
onclick="popupCode('Flagset.src/M000013.html');return false;">
|
271
|
+
<span class="method-name">extended_help_flag</span><span class="method-args">(*args)</span>
|
272
|
+
</a>
|
273
|
+
</div>
|
274
|
+
|
275
|
+
<div class="method-description">
|
276
|
+
<p>
|
277
|
+
top-level <a href="Flagset.html#M000007">flag</a>-declarer
|
278
|
+
</p>
|
279
|
+
</div>
|
280
|
+
</div>
|
281
|
+
|
282
|
+
<div id="method-M000007" class="method-detail">
|
283
|
+
<a name="M000007"></a>
|
284
|
+
|
285
|
+
<div class="method-heading">
|
286
|
+
<a href="Flagset.src/M000007.html" target="Code" class="method-signature"
|
287
|
+
onclick="popupCode('Flagset.src/M000007.html');return false;">
|
288
|
+
<span class="method-name">flag</span><span class="method-args">(flag_name_pair,hash={},&the_block)</span>
|
289
|
+
</a>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
<div class="method-description">
|
293
|
+
<p>
|
294
|
+
top-level <a href="Flagset.html#M000007">flag</a>-declarer
|
295
|
+
</p>
|
296
|
+
</div>
|
297
|
+
</div>
|
298
|
+
|
299
|
+
<div id="method-M000015" class="method-detail">
|
300
|
+
<a name="M000015"></a>
|
301
|
+
|
302
|
+
<div class="method-heading">
|
303
|
+
<a href="Flagset.src/M000015.html" target="Code" class="method-signature"
|
304
|
+
onclick="popupCode('Flagset.src/M000015.html');return false;">
|
305
|
+
<span class="method-name">flag_properties</span><span class="method-args">(symb,hash={},&the_block)</span>
|
306
|
+
</a>
|
307
|
+
</div>
|
308
|
+
|
309
|
+
<div class="method-description">
|
310
|
+
<p>
|
311
|
+
top-level <a href="Flagset.html#M000007">flag</a>-declarer
|
312
|
+
</p>
|
313
|
+
</div>
|
314
|
+
</div>
|
315
|
+
|
316
|
+
<div id="method-M000011" class="method-detail">
|
317
|
+
<a name="M000011"></a>
|
318
|
+
|
319
|
+
<div class="method-heading">
|
320
|
+
<a href="Flagset.src/M000011.html" target="Code" class="method-signature"
|
321
|
+
onclick="popupCode('Flagset.src/M000011.html');return false;">
|
322
|
+
<span class="method-name">flagless_arg</span><span class="method-args">(name)</span>
|
323
|
+
</a>
|
324
|
+
</div>
|
325
|
+
|
326
|
+
<div class="method-description">
|
327
|
+
<p>
|
328
|
+
top-level <a href="Flagset.html#M000007">flag</a>-declarer
|
329
|
+
</p>
|
330
|
+
</div>
|
331
|
+
</div>
|
332
|
+
|
333
|
+
<div id="method-M000017" class="method-detail">
|
334
|
+
<a name="M000017"></a>
|
335
|
+
|
336
|
+
<div class="method-heading">
|
337
|
+
<a href="Flagset.src/M000017.html" target="Code" class="method-signature"
|
338
|
+
onclick="popupCode('Flagset.src/M000017.html');return false;">
|
339
|
+
<span class="method-name">handle_errors_and_help</span><span class="method-args">(level=:not_strict)</span>
|
340
|
+
</a>
|
341
|
+
</div>
|
342
|
+
|
343
|
+
<div class="method-description">
|
344
|
+
<p>
|
345
|
+
Special command (at the same level as a <em><a
|
346
|
+
href="Flagset.html#M000007">flag</a> declaration</em>)
|
347
|
+
</p>
|
348
|
+
</div>
|
349
|
+
</div>
|
350
|
+
|
351
|
+
<div id="method-M000010" class="method-detail">
|
352
|
+
<a name="M000010"></a>
|
353
|
+
|
354
|
+
<div class="method-heading">
|
355
|
+
<a href="Flagset.src/M000010.html" target="Code" class="method-signature"
|
356
|
+
onclick="popupCode('Flagset.src/M000010.html');return false;">
|
357
|
+
<span class="method-name">keyword</span><span class="method-args">(flag_name_pair,hash={},&the_block)</span>
|
358
|
+
</a>
|
359
|
+
</div>
|
360
|
+
|
361
|
+
<div class="method-description">
|
362
|
+
<p>
|
363
|
+
top-level <a href="Flagset.html#M000007">flag</a>-declarer
|
364
|
+
</p>
|
365
|
+
</div>
|
366
|
+
</div>
|
367
|
+
|
368
|
+
<div id="method-M000008" class="method-detail">
|
369
|
+
<a name="M000008"></a>
|
370
|
+
|
371
|
+
<div class="method-heading">
|
372
|
+
<a href="Flagset.src/M000008.html" target="Code" class="method-signature"
|
373
|
+
onclick="popupCode('Flagset.src/M000008.html');return false;">
|
374
|
+
<span class="method-name">optional_flag</span><span class="method-args">(flag_name_pair,hash={},&the_block)</span>
|
375
|
+
</a>
|
376
|
+
</div>
|
377
|
+
|
378
|
+
<div class="method-description">
|
379
|
+
<p>
|
380
|
+
top-level <a href="Flagset.html#M000007">flag</a>-declarer
|
381
|
+
</p>
|
382
|
+
</div>
|
383
|
+
</div>
|
384
|
+
|
385
|
+
<div id="method-M000009" class="method-detail">
|
386
|
+
<a name="M000009"></a>
|
387
|
+
|
388
|
+
<div class="method-heading">
|
389
|
+
<a href="Flagset.src/M000009.html" target="Code" class="method-signature"
|
390
|
+
onclick="popupCode('Flagset.src/M000009.html');return false;">
|
391
|
+
<span class="method-name">optional_switch_flag</span><span class="method-args">(flag_name_pair,hash={},&the_block)</span>
|
392
|
+
</a>
|
393
|
+
</div>
|
394
|
+
|
395
|
+
<div class="method-description">
|
396
|
+
<p>
|
397
|
+
top-level <a href="Flagset.html#M000007">flag</a>-declarer
|
398
|
+
</p>
|
399
|
+
</div>
|
400
|
+
</div>
|
401
|
+
|
402
|
+
<div id="method-M000004" class="method-detail">
|
403
|
+
<a name="M000004"></a>
|
404
|
+
|
405
|
+
<div class="method-heading">
|
406
|
+
<a href="Flagset.src/M000004.html" target="Code" class="method-signature"
|
407
|
+
onclick="popupCode('Flagset.src/M000004.html');return false;">
|
408
|
+
<span class="method-name">parse</span><span class="method-args">(args,clone=true)</span>
|
409
|
+
</a>
|
410
|
+
</div>
|
411
|
+
|
412
|
+
<div class="method-description">
|
413
|
+
</div>
|
414
|
+
</div>
|
415
|
+
|
416
|
+
<div id="method-M000016" class="method-detail">
|
417
|
+
<a name="M000016"></a>
|
418
|
+
|
419
|
+
<div class="method-heading">
|
420
|
+
<span class="method-name">properties</span><span class="method-args">(symb,hash={},&the_block)</span>
|
421
|
+
</div>
|
422
|
+
|
423
|
+
<div class="method-description">
|
424
|
+
<p>
|
425
|
+
Alias for <a href="Flagset.html#M000015">flag_properties</a>
|
426
|
+
</p>
|
427
|
+
</div>
|
428
|
+
</div>
|
429
|
+
|
430
|
+
<div id="method-M000012" class="method-detail">
|
431
|
+
<a name="M000012"></a>
|
432
|
+
|
433
|
+
<div class="method-heading">
|
434
|
+
<a href="Flagset.src/M000012.html" target="Code" class="method-signature"
|
435
|
+
onclick="popupCode('Flagset.src/M000012.html');return false;">
|
436
|
+
<span class="method-name">usage_flag</span><span class="method-args">(*args)</span>
|
437
|
+
</a>
|
438
|
+
</div>
|
439
|
+
|
440
|
+
<div class="method-description">
|
441
|
+
<p>
|
442
|
+
top-level <a href="Flagset.html#M000007">flag</a>-declarer
|
443
|
+
</p>
|
444
|
+
</div>
|
445
|
+
</div>
|
446
|
+
|
447
|
+
|
448
|
+
</div>
|
449
|
+
|
450
|
+
|
451
|
+
</div>
|
452
|
+
|
453
|
+
|
454
|
+
<div id="validator-badges">
|
455
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
456
|
+
</div>
|
457
|
+
|
458
|
+
</body>
|
459
|
+
</html>
|