summaryrefslogtreecommitdiff
path: root/lib/slop/options.rb
diff options
context:
space:
mode:
authorVictor Gama <hey@vito.io>2023-02-10 16:25:08 -0300
committerVictor Gama <hey@vito.io>2023-02-15 11:43:06 -0300
commita23fa41a5674485600365985bea2a905e5e087df (patch)
treec781122a70e710929731ca811cd3f2d7ea4c0023 /lib/slop/options.rb
parentfc4622fc08d7982847ff583ad691ee4ba47f63f8 (diff)
downloadslop-a23fa41a5674485600365985bea2a905e5e087df.tar.gz
Add optional type validation
Diffstat (limited to 'lib/slop/options.rb')
-rwxr-xr-xlib/slop/options.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/slop/options.rb b/lib/slop/options.rb
index 17e9501..5e71eac 100755
--- a/lib/slop/options.rb
+++ b/lib/slop/options.rb
@@ -7,6 +7,7 @@ module Slop
type: "null",
banner: true,
underscore_flags: true,
+ validate_types: false,
}
# The Array of Option instances we've created.
@@ -24,6 +25,9 @@ module Slop
# The String banner prefixed to the help string.
attr_accessor :banner
+ # Whether we should validate types of values provided by the user
+ attr_accessor :validate_types
+
def initialize(**config, &block)
@options = []
@separators = []