summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/slop/types.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/slop/types.rb b/lib/slop/types.rb
index df67aee..ad7461c 100644
--- a/lib/slop/types.rb
+++ b/lib/slop/types.rb
@@ -61,6 +61,13 @@ module Slop
end
end
+ # Cast the option argument to a Regexp.
+ class RegexpOption < Option
+ def call(value)
+ Regexp.new(value)
+ end
+ end
+
# An option that discards the return value, inherits from Bool
# since it does not expect an argument.
class NullOption < BoolOption