optopus 0.1.9 → 0.2.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.
Files changed (2) hide show
  1. data/lib/optopus.rb +10 -1
  2. metadata +8 -6
data/lib/optopus.rb CHANGED
@@ -168,7 +168,7 @@ module Optopus
168
168
 
169
169
  next unless value
170
170
 
171
- value = value.to_s
171
+ value = orig_val = value.to_s
172
172
  type = args.find {|i| i.kind_of?(Class) }
173
173
  pat, conv = OptionParser::DefaultList.atype[type]
174
174
 
@@ -178,6 +178,15 @@ module Optopus
178
178
 
179
179
  value = conv.call(value) if conv
180
180
 
181
+ if value and block
182
+ begin
183
+ CheckerContext.evaluate(v, value, &block)
184
+ rescue OptionParser::ParseError => e
185
+ errmsg = "#{e.message}: #{key}=#{orig_val}"
186
+ raise OptionParser::ParseError, errmsg
187
+ end
188
+ end
189
+
181
190
  options[name] = value
182
191
  end
183
192
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optopus
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 9
10
- version: 0.1.9
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - winebarrel
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-13 00:00:00 Z
18
+ date: 2011-11-17 00:00:00 +09:00
19
+ default_executable:
19
20
  dependencies: []
20
21
 
21
22
  description:
@@ -29,6 +30,7 @@ extra_rdoc_files: []
29
30
  files:
30
31
  - README
31
32
  - lib/optopus.rb
33
+ has_rdoc: true
32
34
  homepage: https://bitbucket.org/winebarrel/optopus
33
35
  licenses: []
34
36
 
@@ -58,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
60
  requirements: []
59
61
 
60
62
  rubyforge_project:
61
- rubygems_version: 1.8.1
63
+ rubygems_version: 1.4.2
62
64
  signing_key:
63
65
  specification_version: 3
64
66
  summary: optopus is an easy-to-use option purser.