optopus 0.1.0 → 0.1.1
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.
- data/README +1 -1
- data/lib/optopus.rb +6 -6
- metadata +3 -3
data/README
CHANGED
data/lib/optopus.rb
CHANGED
@@ -34,8 +34,8 @@ module Optopus
|
|
34
34
|
@opts.add_after(block)
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
38
|
-
@opts.
|
37
|
+
def error(&block)
|
38
|
+
@opts.add_error(block)
|
39
39
|
end
|
40
40
|
end # DefinerContext
|
41
41
|
|
@@ -102,8 +102,8 @@ module Optopus
|
|
102
102
|
@on_after = block
|
103
103
|
end
|
104
104
|
|
105
|
-
def
|
106
|
-
@
|
105
|
+
def add_error(block)
|
106
|
+
@on_error = block
|
107
107
|
end
|
108
108
|
|
109
109
|
def parse!
|
@@ -158,8 +158,8 @@ module Optopus
|
|
158
158
|
|
159
159
|
return options
|
160
160
|
rescue => e
|
161
|
-
if @
|
162
|
-
@
|
161
|
+
if @on_error
|
162
|
+
@on_error.call(e)
|
163
163
|
else
|
164
164
|
raise e
|
165
165
|
end
|
metadata
CHANGED