config_parser 0.3.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/History CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.5.0 / 2010-11-21
2
+
3
+ * yield argv and config to block on parse, if given
4
+ * remove leading whitespace from hint without desc
5
+
1
6
  == 0.3.3 / 2010-10-24
2
7
 
3
8
  * made options aware of whether or not they have assigned a value (fixes
@@ -183,10 +183,10 @@ class ConfigParser
183
183
  case
184
184
  when hint.nil? && desc.nil?
185
185
  ''
186
- when hint.nil?
186
+ when hint.nil?
187
187
  desc.to_s
188
188
  else
189
- "#{desc} (#{hint})"
189
+ "#{desc} (#{hint})".strip
190
190
  end
191
191
  end
192
192
 
@@ -1,7 +1,7 @@
1
1
  class ConfigParser
2
2
  MAJOR = 0
3
- MINOR = 3
4
- TINY = 3
3
+ MINOR = 5
4
+ TINY = 0
5
5
 
6
6
  VERSION = "#{MAJOR}.#{MINOR}.#{TINY}"
7
7
  end
data/lib/config_parser.rb CHANGED
@@ -225,9 +225,9 @@ class ConfigParser
225
225
  #
226
226
  # If a string argv is provided, it will be splits into an array using
227
227
  # Shellwords.
228
- def parse(argv=ARGV)
228
+ def parse(argv=ARGV, &block)
229
229
  argv = argv.dup unless argv.kind_of?(String)
230
- parse!(argv)
230
+ parse!(argv, &block)
231
231
  end
232
232
 
233
233
  # Same as parse, but removes parsed args from argv.
@@ -281,7 +281,7 @@ class ConfigParser
281
281
  args.concat(argv)
282
282
  argv.replace(args)
283
283
 
284
- argv
284
+ block_given? ? yield(argv, config) : argv
285
285
  end
286
286
 
287
287
  # Resets each option and clears the config (if specified). Returns self.
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_parser
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 3
10
- version: 0.3.3
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Simon Chiang
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-24 00:00:00 -06:00
18
+ date: 2010-11-21 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency