optopus 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/optopus.rb +9 -2
  2. metadata +4 -4
data/lib/optopus.rb CHANGED
@@ -157,7 +157,14 @@ module Optopus
157
157
  key = name.to_s
158
158
  end
159
159
 
160
- value = config[key] || config[key.gsub(/[-_]/, '-')] || key.gsub(/[-_]/, '_')
160
+ value = nil
161
+
162
+ [key, key.gsub(/[-_]/, '-'), key.gsub(/[-_]/, '_')].each do |k|
163
+ if value = config[k]
164
+ key = k
165
+ break
166
+ end
167
+ end
161
168
 
162
169
  next unless value
163
170
 
@@ -166,7 +173,7 @@ module Optopus
166
173
  pat, conv = OptionParser::DefaultList.atype[type]
167
174
 
168
175
  if pat and pat !~ value
169
- raise OptionParser::InvalidArgument.new(v, "(#{name}: #{value})")
176
+ raise OptionParser::InvalidArgument.new(v, "(#{key}: #{value})")
170
177
  end
171
178
 
172
179
  value = conv.call(value) if conv
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: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 8
10
- version: 0.1.8
9
+ - 9
10
+ version: 0.1.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - winebarrel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-06 00:00:00 Z
18
+ date: 2011-11-13 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: