optparse 0.3.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3726480fe0a25a9efd1cec645f993256cda45ac050411f046dfb6fa35117414a
4
- data.tar.gz: ace5491689e1e277cd9b0a37b7ff070be46e46b6cb1b3b21f19c02d4d2d792a1
3
+ metadata.gz: a5a9ef5004e5838005ad874fc163ebd1e6266d3319d08be502a8fb2d6b6b48a2
4
+ data.tar.gz: 94fb689cea59f667e4bc4788a6713a50cd829b4e552097994e7b9833f5f35432
5
5
  SHA512:
6
- metadata.gz: af882a7ff3c55fc882fbbc1259d104a55dd15049b64b3022459e868c4a00ba989ac651b5f7c16a260a97c8f4992b07adc3b03ca23ad231adf46cae62be6ae8b6
7
- data.tar.gz: 42d6f1e638d8fdbb43953e0ecda55a00b9460d375a1cb8175bd14dcdbbc2fd94996fae031b0b7f31881d73dc6fa2815c75d146fc2fedc2ea9551797118be22e5
6
+ metadata.gz: 5d0d3a7e51d10a3636e337dfdbe6562ae32e5e4ee18ef61926460f964900f5341f75ae3dd308901e2c1bdf8d5e1c1bd4434d8fe1e2fc77b366bf68690fa9ec85
7
+ data.tar.gz: e494246dfe20878a07d79d3489918b9383a2ade4076023a4fd1ec5f973c2f8111066b85fa8e49b69303ff8ff7301adc4ad5c7d3cccde5650ef93afa9b7819030
data/.document ADDED
@@ -0,0 +1,7 @@
1
+ COPYING
2
+ ChangeLog
3
+ README.md
4
+ doc/
5
+ lib/
6
+ logs/
7
+ misc/
data/.rdoc_options ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ page_dir: doc
3
+ main_page: README.md
4
+ title: Documentation for OptionParser
data/ChangeLog CHANGED
@@ -1,25 +1,275 @@
1
1
  -*- coding: utf-8 -*-
2
2
 
3
- commit 2a1e157ae134b07b8412182502755ec4eb3af499
4
- Author: Hiroshi SHIBATA <hsbt@ruby-lang.org>
5
- AuthorDate: 2022-12-22 17:47:34 +0900
6
- Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
7
- CommitDate: 2022-12-22 17:47:34 +0900
3
+ commit 979bd76281d28044b3def3eadba233a87e62415a
4
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
5
+ AuthorDate: 2024-04-15 18:42:47 +0900
6
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
7
+ CommitDate: 2024-04-15 18:42:47 +0900
8
+
9
+ [DOC] Split fetching commits and building package
10
+
11
+ commit ca883bd3a1ac13957774fcb93e8bccd80b74c9d1
12
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
13
+ AuthorDate: 2024-04-15 18:21:31 +0900
14
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
15
+ CommitDate: 2024-04-15 18:21:31 +0900
16
+
17
+ [DOC] git on Github Actions is old
18
+
19
+ It does not support `--unshallow-exclude` option.
20
+
21
+ commit 7f79bc820ff0e04a05204ec63c5fc3e9c85e14ad
22
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
23
+ AuthorDate: 2024-04-15 18:08:57 +0900
24
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
25
+ CommitDate: 2024-04-15 18:08:57 +0900
26
+
27
+ [DOC] Fix error when no tag found
28
+
29
+ commit add085df63d79d878a8901c42f2cfc3eec56307f
30
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
31
+ AuthorDate: 2024-04-15 15:57:09 +0900
32
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
33
+ CommitDate: 2024-04-15 15:58:54 +0900
34
+
35
+ Fetch upto the previous tag for changelogs
36
+
37
+ commit 436a5c516b67f8aec900f2361567c6fc163ade05
38
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
39
+ AuthorDate: 2024-04-15 15:08:19 +0900
40
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
41
+ CommitDate: 2024-04-15 15:08:19 +0900
42
+
43
+ [DOC] Make timestamps in a ISO 8601-like format
44
+
45
+ commit 3a2dcd72d1fdabf63218cd13c8c7953cb3c28f6b
46
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
47
+ AuthorDate: 2024-04-15 14:55:14 +0900
48
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
49
+ CommitDate: 2024-04-15 14:55:14 +0900
50
+
51
+ [DOC] Make ChangeLog non-empty
52
+
53
+ When the latest version is tagged at the head, there is no commit
54
+ between the tag and the head. Make from the previous tag.
55
+
56
+ commit b7382c02f1092f2c0ef0f4096d3b8428e2adf3fa
57
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
58
+ AuthorDate: 2024-04-15 14:49:59 +0900
59
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
60
+ CommitDate: 2024-04-15 14:49:59 +0900
61
+
62
+ [DOC] Exclude CI-skipped commits from changelogs
8
63
 
9
- Bump version to 0.3.1
64
+ commit b49cb996afdd68e4eb373ba602c95b52c963d160
65
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
66
+ AuthorDate: 2024-04-15 14:24:19 +0900
67
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
68
+ CommitDate: 2024-04-15 14:24:19 +0900
69
+
70
+ [DOC] Package files for RDoc
10
71
 
11
- commit 766f567405a362d0e018d8411df15ce8d70573a6
72
+ commit f5018a8b1ce82f7ac7458d00d099a454c3c03ea1
12
73
  Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
13
- AuthorDate: 2022-12-21 14:07:54 +0900
14
- Commit: GitHub <noreply@github.com>
15
- CommitDate: 2022-12-21 14:07:54 +0900
74
+ AuthorDate: 2024-04-15 14:05:43 +0900
75
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
76
+ CommitDate: 2024-04-15 14:05:43 +0900
77
+
78
+ bump up to 0.5.0
79
+
80
+ commit ece4bb2673c7fa9f53133ba91bbffd423ebadc90
81
+ Author: Koichi Sasada <ko1@atdot.net>
82
+ AuthorDate: 2024-03-27 07:29:38 +0900
83
+ Commit: Koichi Sasada <ko1@atdot.net>
84
+ CommitDate: 2024-04-15 12:08:07 +0900
85
+
86
+ show warning for unused block
87
+
88
+ With verbopse mode (-w), the interpreter shows a warning if
89
+ a block is passed to a method which does not use the given block.
16
90
 
17
- The encoding argument of `Regexp.new` has been ignored since 1.9
91
+ Warning on:
18
92
 
19
- commit 97a198673408d98686a4ec9c3457eef13088c981
20
- Author: Junichi Sato <22004610+sato11@users.noreply.github.com>
21
- AuthorDate: 2022-12-07 15:02:23 +0900
93
+ * the invoked method is not written in C
94
+ * the invoked method is not `initialize`
95
+ * not invoked with `super`
96
+ * the first time on the call-site with the invoked method
97
+ (`obj.foo{}` will be warned once if `foo` is same method)
98
+
99
+ [Feature #15554]
100
+
101
+ `Primitive.attr! :use_block` is introduced to declare that primitive
102
+ functions (written in C) will use passed block.
103
+
104
+ For minitest, test needs some tweak, so use
105
+ https://github.com/minitest/minitest/commit/ea9caafc0754b1d6236a490d59e624b53209734a
106
+ for `test-bundled-gems`.
107
+
108
+ ruby/ruby@9180e33ca3a5886fec3f9e0a2f48072b55914e65
109
+
110
+ commit 77dccce37cb9fd1b8fbc52160d4103d1c4579669
111
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
112
+ AuthorDate: 2024-03-01 01:24:05 +0900
113
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
114
+ CommitDate: 2024-03-01 01:24:05 +0900
115
+
116
+ Invoke pager for `--help`
117
+
118
+ commit 59b9fd7ddca3e795c235aa397655b51de2e4c949
119
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
120
+ AuthorDate: 2024-02-23 21:49:57 +0900
121
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
122
+ CommitDate: 2024-02-23 21:49:57 +0900
123
+
124
+ [DOC] About return value of OptionParser#new
125
+
126
+ commit 07e83673a8e99b5b7985608a69f713abde3344f6
127
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
128
+ AuthorDate: 2024-02-21 13:42:11 +0900
129
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
130
+ CommitDate: 2024-02-23 21:13:51 +0900
131
+
132
+ Add `exact:` keyword argument
133
+
134
+ commit bbec64d0c7f198429b62468b64b27692efa18dc2
135
+ Author: Yusuke Endoh <mame@ruby-lang.org>
136
+ AuthorDate: 2024-01-19 16:03:38 +0900
22
137
  Commit: Hiroshi SHIBATA <hsbt@ruby-lang.org>
23
- CommitDate: 2022-12-08 12:11:51 +0900
138
+ CommitDate: 2024-02-16 10:47:36 +0900
139
+
140
+ Do not include a backtick in error messages and backtraces
141
+
142
+ [Feature #16495]
143
+
144
+ commit 451dea51a0e5d062fb4cb75b1073a2c2b8609bef
145
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
146
+ AuthorDate: 2024-02-12 01:30:58 +0900
147
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
148
+ CommitDate: 2024-02-12 01:30:58 +0900
149
+
150
+ [DOC] Add description of OptionParser#define_by_keywords
151
+
152
+ commit 33956ce93f56320978cedfcebb8b6cf18bf96c53
153
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
154
+ AuthorDate: 2024-02-12 01:07:05 +0900
155
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
156
+ CommitDate: 2024-02-12 01:07:05 +0900
157
+
158
+ [DOC] Add missing documents
159
+
160
+ commit 78afdab30751e1b7cf80bb57d6696b10879f90fe
161
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
162
+ AuthorDate: 2024-02-10 22:56:32 +0900
163
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
164
+ CommitDate: 2024-02-10 22:56:32 +0900
165
+
166
+ Search exactly when `require_exact`
167
+
168
+ To work with options defined as `--[no]-something`.
169
+
170
+ Fix https://bugs.ruby-lang.org/issues/20252
171
+ Fix #60
172
+
173
+ commit 213cb03b5978ddacfbcc8f71ec837d9a6fd4c56d
174
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
175
+ AuthorDate: 2024-02-09 19:03:20 +0900
176
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
177
+ CommitDate: 2024-02-09 19:03:20 +0900
178
+
179
+ Adjust arguments for lambda-callbacks
180
+
181
+ Rake uses [lambda] as callbacks.
182
+ Calling it without omitted argument raises an `ArgumentError`.
183
+
184
+ lambda: https://github.com/ruby/rake/blob/master/lib/rake/application.rb#L543
185
+
186
+ commit 9d53e74aa4421e0c4e2a805a0074ece5aae3773f
187
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
188
+ AuthorDate: 2024-02-09 12:59:43 +0900
189
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
190
+ CommitDate: 2024-02-09 12:59:43 +0900
191
+
192
+ Respect default values in block parameters
193
+
194
+ Fix #55
195
+
196
+ commit 4e346ad337f400dbff855798e859f17455698c2a
197
+ Author: fatkodima <fatkodima123@gmail.com>
198
+ AuthorDate: 2023-10-14 21:52:01 +0300
199
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
200
+ CommitDate: 2024-02-09 12:31:08 +0900
201
+
202
+ Fix `require_exact` to work with options defined as `--[no]-something`
203
+
204
+ commit b14c2c644d18cce226e49ccde8a23b5b991ea8cf
205
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
206
+ AuthorDate: 2024-02-09 12:17:31 +0900
207
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
208
+ CommitDate: 2024-02-09 12:17:31 +0900
209
+
210
+ Escape backslashes
211
+
212
+ commit 434e92fc62ff9571124335a2eedff56df83dae48
213
+ Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
214
+ AuthorDate: 2023-12-18 03:43:27 +0000
215
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
216
+ CommitDate: 2024-02-09 12:14:30 +0900
217
+
218
+ Bump actions/upload-artifact from 3 to 4
219
+
220
+ Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
221
+ - [Release notes](https://github.com/actions/upload-artifact/releases)
222
+ - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)
223
+
224
+ ---
225
+ updated-dependencies:
226
+ - dependency-name: actions/upload-artifact
227
+ dependency-type: direct:production
228
+ update-type: version-update:semver-major
229
+ ...
230
+
231
+ Signed-off-by: dependabot[bot] <support@github.com>
232
+
233
+ commit 48385d3eaf37cd10140274453eeadc4496581fc2
234
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
235
+ AuthorDate: 2024-02-09 12:01:44 +0900
236
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
237
+ CommitDate: 2024-02-09 12:06:40 +0900
238
+
239
+ Create codeql.yml
240
+
241
+ commit 294c6e1ed4b170a8a34ab95c84453829c170223c
242
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
243
+ AuthorDate: 2023-12-25 15:08:05 +0900
244
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
245
+ CommitDate: 2023-12-25 15:08:05 +0900
246
+
247
+ Build packages only on the latest release
248
+
249
+ commit 324ff21f042769444cde41949fc0321f6c6ccf63
250
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
251
+ AuthorDate: 2023-12-18 12:45:44 +0900
252
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
253
+ CommitDate: 2023-12-18 12:45:44 +0900
254
+
255
+ [DOC] Add missing documents
256
+
257
+ commit 667ab35f593f81b7850009385453d20ca8023bba
258
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
259
+ AuthorDate: 2023-12-18 12:24:46 +0900
260
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
261
+ CommitDate: 2023-12-18 12:24:46 +0900
262
+
263
+ [DOC] Add missing secition
264
+
265
+ Fixes #51
266
+
267
+ commit 1c895efc39ed2290c185dcb80523fee381dfe74e
268
+ Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
269
+ AuthorDate: 2023-12-18 12:15:31 +0900
270
+ Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
271
+ CommitDate: 2023-12-18 12:15:31 +0900
272
+
273
+ [DOC] Fix tutorial link
24
274
 
25
- Use GITHUB_OUTPUT instead of deprecated set-output
275
+ Fixes #51
@@ -0,0 +1 @@
1
+ *.rdoc
@@ -1,7 +1,7 @@
1
1
  == Argument Converters
2
2
 
3
3
  An option can specify that its argument is to be converted
4
- from the default \String to an instance of another class.
4
+ from the default +String+ to an instance of another class.
5
5
 
6
6
  === Contents
7
7
 
@@ -27,13 +27,13 @@ from the default \String to an instance of another class.
27
27
 
28
28
  === Built-In Argument Converters
29
29
 
30
- \OptionParser has a number of built-in argument converters,
30
+ +OptionParser+ has a number of built-in argument converters,
31
31
  which are demonstrated below.
32
32
 
33
- ==== \Date
33
+ ==== +Date+
34
34
 
35
35
  File +date.rb+
36
- defines an option whose argument is to be converted to a \Date object.
36
+ defines an option whose argument is to be converted to a +Date+ object.
37
37
  The argument is converted by method Date#parse.
38
38
 
39
39
  :include: ruby/date.rb
@@ -47,10 +47,10 @@ Executions:
47
47
  $ ruby date.rb --date "3rd Feb 2001"
48
48
  [#<Date: 2001-02-03 ((2451944j,0s,0n),+0s,2299161j)>, Date]
49
49
 
50
- ==== \DateTime
50
+ ==== +DateTime+
51
51
 
52
52
  File +datetime.rb+
53
- defines an option whose argument is to be converted to a \DateTime object.
53
+ defines an option whose argument is to be converted to a +DateTime+ object.
54
54
  The argument is converted by method DateTime#parse.
55
55
 
56
56
  :include: ruby/datetime.rb
@@ -64,10 +64,10 @@ Executions:
64
64
  $ ruby datetime.rb --datetime "3rd Feb 2001 04:05:06 PM"
65
65
  [#<DateTime: 2001-02-03T16:05:06+00:00 ((2451944j,57906s,0n),+0s,2299161j)>, DateTime]
66
66
 
67
- ==== \Time
67
+ ==== +Time+
68
68
 
69
69
  File +time.rb+
70
- defines an option whose argument is to be converted to a \Time object.
70
+ defines an option whose argument is to be converted to a +Time+ object.
71
71
  The argument is converted by method Time#httpdate or Time#parse.
72
72
 
73
73
  :include: ruby/time.rb
@@ -79,10 +79,10 @@ Executions:
79
79
  $ ruby time.rb --time 2010-10-31
80
80
  [2010-10-31 00:00:00 -0500, Time]
81
81
 
82
- ==== \URI
82
+ ==== +URI+
83
83
 
84
84
  File +uri.rb+
85
- defines an option whose argument is to be converted to a \URI object.
85
+ defines an option whose argument is to be converted to a +URI+ object.
86
86
  The argument is converted by method URI#parse.
87
87
 
88
88
  :include: ruby/uri.rb
@@ -96,10 +96,10 @@ Executions:
96
96
  $ ruby uri.rb --uri file://~/var
97
97
  [#<URI::File file://~/var>, URI::File]
98
98
 
99
- ==== \Shellwords
99
+ ==== +Shellwords+
100
100
 
101
101
  File +shellwords.rb+
102
- defines an option whose argument is to be converted to an \Array object by method
102
+ defines an option whose argument is to be converted to an +Array+ object by method
103
103
  Shellwords#shellwords.
104
104
 
105
105
  :include: ruby/shellwords.rb
@@ -111,10 +111,10 @@ Executions:
111
111
  $ ruby shellwords.rb --shellwords "here are 'two words'"
112
112
  [["here", "are", "two words"], Array]
113
113
 
114
- ==== \Integer
114
+ ==== +Integer+
115
115
 
116
116
  File +integer.rb+
117
- defines an option whose argument is to be converted to an \Integer object.
117
+ defines an option whose argument is to be converted to an +Integer+ object.
118
118
  The argument is converted by method Kernel#Integer.
119
119
 
120
120
  :include: ruby/integer.rb
@@ -132,10 +132,10 @@ Executions:
132
132
  $ ruby integer.rb --integer 0b100
133
133
  [4, Integer]
134
134
 
135
- ==== \Float
135
+ ==== +Float+
136
136
 
137
137
  File +float.rb+
138
- defines an option whose argument is to be converted to a \Float object.
138
+ defines an option whose argument is to be converted to a +Float+ object.
139
139
  The argument is converted by method Kernel#Float.
140
140
 
141
141
  :include: ruby/float.rb
@@ -151,11 +151,11 @@ Executions:
151
151
  $ ruby float.rb --float 1.234E-2
152
152
  [0.01234, Float]
153
153
 
154
- ==== \Numeric
154
+ ==== +Numeric+
155
155
 
156
156
  File +numeric.rb+
157
157
  defines an option whose argument is to be converted to an instance
158
- of \Rational, \Float, or \Integer.
158
+ of +Rational+, +Float+, or +Integer+.
159
159
  The argument is converted by method Kernel#Rational,
160
160
  Kernel#Float, or Kernel#Integer.
161
161
 
@@ -170,10 +170,10 @@ Executions:
170
170
  $ ruby numeric.rb --numeric 3
171
171
  [3, Integer]
172
172
 
173
- ==== \DecimalInteger
173
+ ==== +DecimalInteger+
174
174
 
175
175
  File +decimal_integer.rb+
176
- defines an option whose argument is to be converted to an \Integer object.
176
+ defines an option whose argument is to be converted to an +Integer+ object.
177
177
  The argument is converted by method Kernel#Integer.
178
178
 
179
179
  :include: ruby/decimal_integer.rb
@@ -192,10 +192,10 @@ Executions:
192
192
  $ ruby decimal_integer.rb --decimal_integer -0100
193
193
  [-100, Integer]
194
194
 
195
- ==== \OctalInteger
195
+ ==== +OctalInteger+
196
196
 
197
197
  File +octal_integer.rb+
198
- defines an option whose argument is to be converted to an \Integer object.
198
+ defines an option whose argument is to be converted to an +Integer+ object.
199
199
  The argument is converted by method Kernel#Integer.
200
200
 
201
201
  :include: ruby/octal_integer.rb
@@ -212,10 +212,10 @@ Executions:
212
212
  $ ruby octal_integer.rb --octal_integer 0100
213
213
  [64, Integer]
214
214
 
215
- ==== \DecimalNumeric
215
+ ==== +DecimalNumeric+
216
216
 
217
217
  File +decimal_numeric.rb+
218
- defines an option whose argument is to be converted to an \Integer object.
218
+ defines an option whose argument is to be converted to an +Integer+ object.
219
219
  The argument is converted by method Kernel#Integer
220
220
 
221
221
  :include: ruby/decimal_numeric.rb
@@ -232,7 +232,7 @@ Executions:
232
232
  $ ruby decimal_numeric.rb --decimal_numeric 0100
233
233
  [64, Integer]
234
234
 
235
- ==== \TrueClass
235
+ ==== +TrueClass+
236
236
 
237
237
  File +true_class.rb+
238
238
  defines an option whose argument is to be converted to +true+ or +false+.
@@ -259,7 +259,7 @@ Executions:
259
259
  $ ruby true_class.rb --true_class nil
260
260
  [false, FalseClass]
261
261
 
262
- ==== \FalseClass
262
+ ==== +FalseClass+
263
263
 
264
264
  File +false_class.rb+
265
265
  defines an option whose argument is to be converted to +true+ or +false+.
@@ -286,10 +286,10 @@ Executions:
286
286
  $ ruby false_class.rb --false_class +
287
287
  [true, TrueClass]
288
288
 
289
- ==== \Object
289
+ ==== +Object+
290
290
 
291
291
  File +object.rb+
292
- defines an option whose argument is not to be converted from \String.
292
+ defines an option whose argument is not to be converted from +String+.
293
293
 
294
294
  :include: ruby/object.rb
295
295
 
@@ -300,10 +300,10 @@ Executions:
300
300
  $ ruby object.rb --object nil
301
301
  ["nil", String]
302
302
 
303
- ==== \String
303
+ ==== +String+
304
304
 
305
305
  File +string.rb+
306
- defines an option whose argument is not to be converted from \String.
306
+ defines an option whose argument is not to be converted from +String+.
307
307
 
308
308
  :include: ruby/string.rb
309
309
 
@@ -314,10 +314,10 @@ Executions:
314
314
  $ ruby string.rb --string nil
315
315
  ["nil", String]
316
316
 
317
- ==== \Array
317
+ ==== +Array+
318
318
 
319
319
  File +array.rb+
320
- defines an option whose argument is to be converted from \String
320
+ defines an option whose argument is to be converted from +String+
321
321
  to an array of strings, based on comma-separated substrings.
322
322
 
323
323
  :include: ruby/array.rb
@@ -331,10 +331,10 @@ Executions:
331
331
  $ ruby array.rb --array "foo, bar, baz"
332
332
  [["foo", " bar", " baz"], Array]
333
333
 
334
- ==== \Regexp
334
+ ==== +Regexp+
335
335
 
336
336
  File +regexp.rb+
337
- defines an option whose argument is to be converted to a \Regexp object.
337
+ defines an option whose argument is to be converted to a +Regexp+ object.
338
338
 
339
339
  :include: ruby/regexp.rb
340
340
 
@@ -352,7 +352,7 @@ To create a custom converter, call OptionParser#accept with:
352
352
  - A block that accepts the argument and returns the converted value.
353
353
 
354
354
  This custom converter accepts any argument and converts it,
355
- if possible, to a \Complex object.
355
+ if possible, to a +Complex+ object.
356
356
 
357
357
  :include: ruby/custom_converter.rb
358
358
 
@@ -1,6 +1,6 @@
1
1
  == Parameters for New Options
2
2
 
3
- Option-creating methods in \OptionParser
3
+ Option-creating methods in +OptionParser+
4
4
  accept arguments that determine the behavior of a new option:
5
5
 
6
6
  - OptionParser#on
@@ -31,7 +31,7 @@ Contents:
31
31
  - {Long Names with Optional Arguments}[#label-Long+Names+with+Optional+Arguments]
32
32
  - {Long Names with Negation}[#label-Long+Names+with+Negation]
33
33
  - {Mixed Names}[#label-Mixed+Names]
34
- - {Argument Styles}[#label-Argument+Styles]
34
+ - {Argument Strings}[#label-Argument+Strings]
35
35
  - {Argument Values}[#label-Argument+Values]
36
36
  - {Explicit Argument Values}[#label-Explicit+Argument+Values]
37
37
  - {Explicit Values in Array}[#label-Explicit+Values+in+Array]
@@ -405,7 +405,7 @@ Executions:
405
405
  === Argument Converters
406
406
 
407
407
  An option can specify that its argument is to be converted
408
- from the default \String to an instance of another class.
408
+ from the default +String+ to an instance of another class.
409
409
 
410
410
  There are a number of built-in converters.
411
411
  You can also define custom converters.
@@ -0,0 +1,9 @@
1
+ require 'optparse'
2
+ parser = OptionParser.new
3
+ parser.on('-x', '--xxx=VALUE', %w[ABC def], 'Argument abbreviations') do |value|
4
+ p ['--xxx', value]
5
+ end
6
+ parser.on('-y', '--yyy=VALUE', {"abc"=>"XYZ", def: "FOO"}, 'Argument abbreviations') do |value|
7
+ p ['--yyy', value]
8
+ end
9
+ parser.parse!