Method: FastlaneCore::ConfigItem#valid?

Defined in:
fastlane_core/lib/fastlane_core/configuration/config_item.rb

#valid?(value) ⇒ Boolean

Make sure, the value is valid (based on the verify block) Raises an exception if the value is invalid

Returns:



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'fastlane_core/lib/fastlane_core/configuration/config_item.rb', line 232

def valid?(value)
  # we also allow nil values, which do not have to be verified.
  return true if value.nil?

  # Verify that value is the type that we're expecting, if we are expecting a type
  if data_type == Fastlane::Boolean
    ensure_boolean_type_passes_validation(value)
  elsif data_type == Array
    ensure_array_type_passes_validation(value)
  else
    ensure_generic_type_passes_validation(value)
  end

  if @verify_block
    begin
      @verify_block.call(value)
    rescue => ex
      UI.error("Error setting value '#{value}' for option '#{@key}'")
      raise Interface::FastlaneError.new, ex.to_s
    end
  end

  true
end