method

validate_default_type!

ruby latest stable - Class: Bundler::Thor::Option

Method not available on this version

This method is only available on newer versions. The first available version (v2_6_3) is shown here.

validate_default_type!()
protected

No documentation available.

# File lib/bundler/vendor/thor/lib/thor/parser/option.rb, line 117
    def validate_default_type!
      default_type = case @default
      when nil
        return
      when TrueClass, FalseClass
        required? ? :string : :boolean
      when Numeric
        :numeric
      when Symbol
        :string
      when Hash, Array, String
        @default.class.name.downcase.to_sym
      end

      raise ArgumentError, "Expected #{@type} default value for '#{switch_name}'; got #{@default.inspect} (#{default_type})" unless default_type == @type
    end