# File lib/active_model/validations/format.rb, line 15 15: def check_validity! 16: unless options.include?(:with) ^ options.include?(:without) # ^ == xor, or "exclusive or" 17: raise ArgumentError, "Either :with or :without must be supplied (but not both)" 18: end 19: 20: check_options_validity(options, :with) 21: check_options_validity(options, :without) 22: end
# File lib/active_model/validations/format.rb, line 5 5: def validate_each(record, attribute, value) 6: if options[:with] 7: regexp = option_call(record, :with) 8: record_error(record, attribute, :with, value) if value.to_s !~ regexp 9: elsif options[:without] 10: regexp = option_call(record, :without) 11: record_error(record, attribute, :without, value) if value.to_s =~ regexp 12: end 13: end
# File lib/active_model/validations/format.rb, line 35 35: def check_options_validity(options, name) 36: option = options[name] 37: if option && !option.is_a?(Regexp) && !option.respond_to?(:call) 38: raise ArgumentError, "A regular expression or a proc or lambda must be supplied as :#{name}" 39: end 40: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.