diff options
author | sigurdsvela <sigurdbergsvela@gmail.com> | 2015-04-06 23:13:46 +0200 |
---|---|---|
committer | sigurdsvela <sigurdbergsvela@gmail.com> | 2015-04-06 23:13:46 +0200 |
commit | 48d1aec2c4a42493ea06da0302538dc9ac834695 (patch) | |
tree | 32cc2e91f5aede4371a1bab414be243589011ff5 /lib/slop/error.rb | |
parent | 877946b0a16607bec39dcd437d30e7bb0afa4600 (diff) | |
download | slop-48d1aec2c4a42493ea06da0302538dc9ac834695.tar.gz |
Implement getUnknownMessage in UnknownOption
This allows to retrive the unknown option in
question when catching the error.
This can be useful to, for example, taylor a
spesific output for common errors amongst users.
Diffstat (limited to 'lib/slop/error.rb')
-rw-r--r-- | lib/slop/error.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/slop/error.rb b/lib/slop/error.rb index 55e0fe0..776b939 100644 --- a/lib/slop/error.rb +++ b/lib/slop/error.rb @@ -16,5 +16,14 @@ module Slop # Raised when an unknown option is parsed. Suppress # with the `suppress_errors` config option. - class UnknownOption < Error; end + class UnknownOption < Error; + def initialize(msg, unknownOption) + super(msg); + @unknownOption = unknownOption; + end + + def getUnknowOption() + return @unknownOption; + end + end end |