From b95d6e84b00bd926b1118f6a820eca7a870b8c35 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 14 Aug 2010 02:13:00 -0300 Subject: Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) --- activemodel/lib/active_model/validator.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'activemodel/lib/active_model/validator.rb') diff --git a/activemodel/lib/active_model/validator.rb b/activemodel/lib/active_model/validator.rb index 163124d531..1262d305d1 100644 --- a/activemodel/lib/active_model/validator.rb +++ b/activemodel/lib/active_model/validator.rb @@ -5,8 +5,8 @@ require 'active_support/core_ext/object/blank' module ActiveModel #:nodoc: # == Active Model Validator - # - # A simple base class that can be used along with + # + # A simple base class that can be used along with # +ActiveModel::Validations::ClassMethods.validates_with+ # # class Person @@ -61,31 +61,31 @@ module ActiveModel #:nodoc: # @my_custom_field = options[:field_name] || :first_name # end # end - # + # # The easiest way to add custom validators for validating individual attributes # is with the convenient ActiveModel::EachValidator for example: - # + # # class TitleValidator < ActiveModel::EachValidator # def validate_each(record, attribute, value) # record.errors[attribute] << 'must be Mr. Mrs. or Dr.' unless ['Mr.', 'Mrs.', 'Dr.'].include?(value) # end # end - # + # # This can now be used in combination with the +validates+ method # (see ActiveModel::Validations::ClassMethods.validates for more on this) - # + # # class Person # include ActiveModel::Validations # attr_accessor :title - # + # # validates :title, :presence => true, :title => true # end - # + # # Validator may also define a +setup+ instance method which will get called # with the class that using that validator as it's argument. This can be # useful when there are prerequisites such as an attr_accessor being present # for example: - # + # # class MyValidator < ActiveModel::Validator # def setup(klass) # klass.send :attr_accessor, :custom_attribute @@ -94,7 +94,7 @@ module ActiveModel #:nodoc: # # This setup method is only called when used with validation macros or the # class level validates_with method. - # + # class Validator attr_reader :options @@ -133,7 +133,7 @@ module ActiveModel #:nodoc: # All Active Model validations are built on top of this Validator. class EachValidator < Validator attr_reader :attributes - + # Returns a new validator instance. All options will be available via the # +options+ reader, however the :attributes option will be removed # and instead be made available through the +attributes+ reader. -- cgit v1.2.3