@@ -153,17 +153,20 @@ def check_unknown_options?(config) #:nodoc:
153153
154154 # If you want to raise an error when the default value of an option does not match
155155 # the type call check_default_type!
156- # This is disabled by default for compatibility.
156+ # This will be the default; for compatibility a deprecation warning is issued if necessary .
157157 def check_default_type!
158158 @check_default_type = true
159159 end
160160
161- def check_default_type #:nodoc:
162- @check_default_type ||= from_superclass ( :check_default_type , false )
161+ # If you want to use defaults that don't match the type of an option,
162+ # either specify `check_default_type: false` or call `allow_incompatible_default_type!`
163+ def allow_incompatible_default_type!
164+ @check_default_type = false
163165 end
164166
165- def check_default_type? #:nodoc:
166- !!check_default_type
167+ def check_default_type #:nodoc:
168+ @check_default_type = from_superclass ( :check_default_type , nil ) unless defined? ( @check_default_type )
169+ @check_default_type
167170 end
168171
169172 # If true, option parsing is suspended as soon as an unknown option or a
@@ -564,7 +567,7 @@ def is_thor_reserved_word?(word, type) #:nodoc:
564567 # options<Hash>:: Described in both class_option and method_option.
565568 # scope<Hash>:: Options hash that is being built up
566569 def build_option ( name , options , scope ) #:nodoc:
567- scope [ name ] = Thor ::Option . new ( name , options . merge ( :check_default_type => check_default_type? ) )
570+ scope [ name ] = Thor ::Option . new ( name , options . merge ( :check_default_type => check_default_type ) )
568571 end
569572
570573 # Receives a hash of options, parse them and add to the scope. This is a
0 commit comments