parseargs 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/{parseargs-0.2.0.rb → parseargs-0.3.0.rb} +11 -19
- data/lib/parseargs.rb +11 -19
- metadata +3 -3
@@ -4,7 +4,7 @@ unless defined? $__parseargs__
|
|
4
4
|
ParseArgs::LIBDIR = File::dirname(File::expand_path(__FILE__)) + File::SEPARATOR unless
|
5
5
|
defined? ParseArgs::LIBDIR
|
6
6
|
|
7
|
-
ParseArgs::VERSION = '0.
|
7
|
+
ParseArgs::VERSION = '0.3.0' unless
|
8
8
|
defined? ParseArgs::VERSION
|
9
9
|
|
10
10
|
require 'enumerator'
|
@@ -173,22 +173,27 @@ unless defined? $__parseargs__
|
|
173
173
|
instance_eval &b
|
174
174
|
#--}}}
|
175
175
|
end
|
176
|
-
def
|
176
|
+
def define(what, list, required, *descs)
|
177
177
|
#--{{{
|
178
178
|
unless descs.empty?
|
179
179
|
metadata = descs.size >= 2 && Hash === descs.last ? descs.pop : {}
|
180
180
|
descs.flatten!
|
181
|
-
mdefault
|
181
|
+
mdefault = get_kw('default', metadata)
|
182
182
|
descs.each do |desc|
|
183
183
|
names, default = Hash === desc ? desc.to_a.first : [desc, mdefault]
|
184
184
|
req = default ? false : required
|
185
185
|
names = [ names ] unless names.respond_to? :each
|
186
186
|
names.each do |name|
|
187
|
-
list <<
|
187
|
+
list << what::new(name, metadata.merge('required' => req,'default' => default))
|
188
188
|
end
|
189
189
|
end
|
190
190
|
end
|
191
191
|
list
|
192
|
+
#--}}}
|
193
|
+
end
|
194
|
+
def define_arguments(list, required, *descs)
|
195
|
+
#--{{{
|
196
|
+
define Argument, list, required, *descs
|
192
197
|
#--}}}
|
193
198
|
end
|
194
199
|
def required_arguments(*descs)
|
@@ -233,20 +238,7 @@ unless defined? $__parseargs__
|
|
233
238
|
alias oa optional_arguments
|
234
239
|
def define_keywords(list, required, *descs)
|
235
240
|
#--{{{
|
236
|
-
|
237
|
-
metadata = descs.size >= 2 && Hash === descs.last ? descs.pop : {}
|
238
|
-
descs.flatten!
|
239
|
-
mdefault ||= get_kw('default', metadata)
|
240
|
-
descs.each do |desc|
|
241
|
-
names, default = Hash === desc ? desc.to_a.first : [desc, mdefault]
|
242
|
-
req = default ? false : required
|
243
|
-
names = [ names ] unless names.respond_to? :each
|
244
|
-
names.each do |name|
|
245
|
-
list << Keyword::new(name, metadata.merge('required'=>req,'default'=>default))
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
list
|
241
|
+
define Keyword, list, required, *descs
|
250
242
|
#--}}}
|
251
243
|
end
|
252
244
|
def required_keywords(*descs)
|
@@ -272,7 +264,7 @@ unless defined? $__parseargs__
|
|
272
264
|
def optional_keywords(*descs)
|
273
265
|
#--{{{
|
274
266
|
if descs.empty?
|
275
|
-
@
|
267
|
+
@optional_keywords
|
276
268
|
else
|
277
269
|
define_keywords(@optional_keywords, false, *descs)
|
278
270
|
end
|
data/lib/parseargs.rb
CHANGED
@@ -4,7 +4,7 @@ unless defined? $__parseargs__
|
|
4
4
|
ParseArgs::LIBDIR = File::dirname(File::expand_path(__FILE__)) + File::SEPARATOR unless
|
5
5
|
defined? ParseArgs::LIBDIR
|
6
6
|
|
7
|
-
ParseArgs::VERSION = '0.
|
7
|
+
ParseArgs::VERSION = '0.3.0' unless
|
8
8
|
defined? ParseArgs::VERSION
|
9
9
|
|
10
10
|
require 'enumerator'
|
@@ -173,22 +173,27 @@ unless defined? $__parseargs__
|
|
173
173
|
instance_eval &b
|
174
174
|
#--}}}
|
175
175
|
end
|
176
|
-
def
|
176
|
+
def define(what, list, required, *descs)
|
177
177
|
#--{{{
|
178
178
|
unless descs.empty?
|
179
179
|
metadata = descs.size >= 2 && Hash === descs.last ? descs.pop : {}
|
180
180
|
descs.flatten!
|
181
|
-
mdefault
|
181
|
+
mdefault = get_kw('default', metadata)
|
182
182
|
descs.each do |desc|
|
183
183
|
names, default = Hash === desc ? desc.to_a.first : [desc, mdefault]
|
184
184
|
req = default ? false : required
|
185
185
|
names = [ names ] unless names.respond_to? :each
|
186
186
|
names.each do |name|
|
187
|
-
list <<
|
187
|
+
list << what::new(name, metadata.merge('required' => req,'default' => default))
|
188
188
|
end
|
189
189
|
end
|
190
190
|
end
|
191
191
|
list
|
192
|
+
#--}}}
|
193
|
+
end
|
194
|
+
def define_arguments(list, required, *descs)
|
195
|
+
#--{{{
|
196
|
+
define Argument, list, required, *descs
|
192
197
|
#--}}}
|
193
198
|
end
|
194
199
|
def required_arguments(*descs)
|
@@ -233,20 +238,7 @@ unless defined? $__parseargs__
|
|
233
238
|
alias oa optional_arguments
|
234
239
|
def define_keywords(list, required, *descs)
|
235
240
|
#--{{{
|
236
|
-
|
237
|
-
metadata = descs.size >= 2 && Hash === descs.last ? descs.pop : {}
|
238
|
-
descs.flatten!
|
239
|
-
mdefault ||= get_kw('default', metadata)
|
240
|
-
descs.each do |desc|
|
241
|
-
names, default = Hash === desc ? desc.to_a.first : [desc, mdefault]
|
242
|
-
req = default ? false : required
|
243
|
-
names = [ names ] unless names.respond_to? :each
|
244
|
-
names.each do |name|
|
245
|
-
list << Keyword::new(name, metadata.merge('required'=>req,'default'=>default))
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
list
|
241
|
+
define Keyword, list, required, *descs
|
250
242
|
#--}}}
|
251
243
|
end
|
252
244
|
def required_keywords(*descs)
|
@@ -272,7 +264,7 @@ unless defined? $__parseargs__
|
|
272
264
|
def optional_keywords(*descs)
|
273
265
|
#--{{{
|
274
266
|
if descs.empty?
|
275
|
-
@
|
267
|
+
@optional_keywords
|
276
268
|
else
|
277
269
|
define_keywords(@optional_keywords, false, *descs)
|
278
270
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: parseargs
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2005-10-
|
6
|
+
version: 0.3.0
|
7
|
+
date: 2005-10-24 00:00:00.000000 -06:00
|
8
8
|
summary: parseargs
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -30,7 +30,7 @@ authors:
|
|
30
30
|
- Ara T. Howard
|
31
31
|
files:
|
32
32
|
- lib/parseargs.rb
|
33
|
-
- lib/parseargs-0.
|
33
|
+
- lib/parseargs-0.3.0.rb
|
34
34
|
test_files: []
|
35
35
|
rdoc_options: []
|
36
36
|
extra_rdoc_files: []
|