class ActiveModel::Validations::FormatValidator

def check_validity!

def check_validity!
  unless options.include?(:with) ^ options.include?(:without)  # ^ == xor, or "exclusive or"
    raise ArgumentError, "Either :with or :without must be supplied (but not both)"
  end
  check_options_validity :with
  check_options_validity :without
end