Method: Addressable::URI#defer_validation

Defined in:
lib/addressable/uri.rb

#defer_validationObject

This method allows you to make several changes to a URI simultaneously, which separately would cause validation errors, but in conjunction, are valid. The URI will be revalidated as soon as the entire block has been executed.

Parameters:

  • block (Proc)

    A set of operations to perform on a given URI.



2396
2397
2398
2399
2400
2401
2402
2403
2404
# File 'lib/addressable/uri.rb', line 2396

def defer_validation
  raise LocalJumpError, "No block given." unless block_given?
  @validation_deferred = true
  yield
  @validation_deferred = false
  validate
ensure
  @validation_deferred = false
end