@@ -153,17 +153,20 @@ def check_unknown_options?(config) #:nodoc:
153
153
154
154
# If you want to raise an error when the default value of an option does not match
155
155
# 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 .
157
157
def check_default_type!
158
158
@check_default_type = true
159
159
end
160
160
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
163
165
end
164
166
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
167
170
end
168
171
169
172
# 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:
564
567
# options<Hash>:: Described in both class_option and method_option.
565
568
# scope<Hash>:: Options hash that is being built up
566
569
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 , { :check_default_type => check_default_type } . merge! ( options ) )
568
571
end
569
572
570
573
# Receives a hash of options, parse them and add to the scope. This is a
0 commit comments