optimus 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/optimus/implementations/standard.rb +9 -6
- data/lib/optimus/version.rb +1 -1
- metadata +3 -3
@@ -49,7 +49,7 @@ class Standard < Implementation
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def parse (result, values, options=nil)
|
52
|
-
options
|
52
|
+
options = @options.merge(options) if options.is_a? Hash
|
53
53
|
active = nil
|
54
54
|
type = nil
|
55
55
|
|
@@ -64,15 +64,15 @@ class Standard < Implementation
|
|
64
64
|
active = nil
|
65
65
|
else
|
66
66
|
if matches = value.match(/^#{Regexp.escape(@options[:separators][:long])}(\w+)$/)
|
67
|
-
active = matches[1]
|
67
|
+
active = matches[1].to_sym
|
68
68
|
type = :long
|
69
69
|
elsif matches = value.match(/^#{Regexp.escape(@options[:separators][:short])}(\w+)$/)
|
70
70
|
if matches[1].length == 1
|
71
|
-
active = matches[1]
|
71
|
+
active = matches[1].to_sym
|
72
72
|
type = :short
|
73
73
|
else
|
74
74
|
matches[1].chars.each {|char|
|
75
|
-
result.data[:parameters][char] = { :type => :short, :value => true }
|
75
|
+
result.data[:parameters][char.to_sym] = { :type => :short, :value => true }
|
76
76
|
}
|
77
77
|
end
|
78
78
|
else
|
@@ -175,10 +175,13 @@ class Standard < Implementation
|
|
175
175
|
value = Date.parse(@parameters[option.long])
|
176
176
|
|
177
177
|
when :array
|
178
|
-
value = @parameters[option.long].split(/,/)
|
178
|
+
value = (@parameters[option.long] || '').split(/,/)
|
179
179
|
|
180
180
|
when :hash
|
181
|
-
value = Hash[@parameters[option.long].split(/,/).split(/=/)]
|
181
|
+
value = Hash[(@parameters[option.long] || '').split(/,/).split(/=/)]
|
182
|
+
|
183
|
+
else
|
184
|
+
value = @parameters[option.long]
|
182
185
|
end
|
183
186
|
|
184
187
|
@parameters[option.long] = value
|
data/lib/optimus/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- tilde
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-16 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|