summaryrefslogtreecommitdiff
path: root/lib/slop/types.rb
diff options
context:
space:
mode:
authorLee Jarvis <leejarvis@fastmail.com>2021-05-11 14:02:38 +0100
committerGitHub <noreply@github.com>2021-05-11 14:02:38 +0100
commita8e94a28caffe48f5cd18086d533d9e7afeb74eb (patch)
tree1329bf0982a775e4549c24c4a19b5af3c3149ea4 /lib/slop/types.rb
parent3cbd0e9dfaa6804d6f46fbbec08155a680193cd7 (diff)
parent22e0e6e52f502493c00443a60c73809cfea539ff (diff)
downloadslop-a8e94a28caffe48f5cd18086d533d9e7afeb74eb.tar.gz
Merge pull request #263 from threemachines/symbols
Add symbols to option types
Diffstat (limited to 'lib/slop/types.rb')
-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 c53319c..4ccd42e 100644
--- a/lib/slop/types.rb
+++ b/lib/slop/types.rb
@@ -6,6 +6,13 @@ module Slop
end
end
+ # Cast the option argument to a symbol.
+ class SymbolOption < Option
+ def call(value)
+ value.to_sym
+ end
+ end
+
# Cast the option argument to true or false.
# Override default_value to default to false instead of nil.
# This option type does not expect an argument. However, the API