From f99db5a6a8295b463325accaefe53ab6c89c9982 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Mon, 7 Mar 2011 23:56:16 +0530 Subject: formatting changes --- activemodel/lib/active_model/validations.rb | 6 +++--- activemodel/lib/active_model/validator.rb | 23 +++++++++++------------ 2 files changed, 14 insertions(+), 15 deletions(-) (limited to 'activemodel') diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index 98af88b5a0..d968609e67 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -36,8 +36,8 @@ module ActiveModel # person.invalid? # => true # person.errors # => #["starts with z."]}> # - # Note that ActiveModel::Validations automatically adds an +errors+ method - # to your instances initialized with a new ActiveModel::Errors object, so + # Note that ActiveModel::Validations automatically adds an +errors+ method + # to your instances initialized with a new ActiveModel::Errors object, so # there is no need for you to do this manually. # module Validations @@ -165,7 +165,7 @@ module ActiveModel end end - # Returns the Errors object that holds all information about attribute error messages. + # Returns the +Errors+ object that holds all information about attribute error messages. def errors @errors ||= Errors.new(self) end diff --git a/activemodel/lib/active_model/validator.rb b/activemodel/lib/active_model/validator.rb index 649d7f02b1..1c6123eb09 100644 --- a/activemodel/lib/active_model/validator.rb +++ b/activemodel/lib/active_model/validator.rb @@ -63,7 +63,7 @@ module ActiveModel #:nodoc: # end # # The easiest way to add custom validators for validating individual attributes - # is with the convenient ActiveModel::EachValidator for example: + # is with the convenient ActiveModel::EachValidator. For example: # # class TitleValidator < ActiveModel::EachValidator # def validate_each(record, attribute, value) @@ -72,18 +72,18 @@ module ActiveModel #:nodoc: # end # # This can now be used in combination with the +validates+ method - # (see ActiveModel::Validations::ClassMethods.validates for more on this) + # (see ActiveModel::Validations::ClassMethods.validates for more on this) # # class Person # include ActiveModel::Validations # attr_accessor :title # - # validates :title, :presence => true, :title => true + # validates :title, :presence => 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 + # with the class that using that validator as its argument. This can be + # useful when there are prerequisites such as an +attr_accessor+ being present # for example: # # class MyValidator < ActiveModel::Validator @@ -124,11 +124,11 @@ module ActiveModel #:nodoc: end end - # EachValidator is a validator which iterates through the attributes given - # in the options hash invoking the validate_each method passing in the + # +EachValidator+ is a validator which iterates through the attributes given + # in the options hash invoking the validate_each method passing in the # record, attribute and value. # - # All Active Model validations are built on top of this Validator. + # All Active Model validations are built on top of this validator. class EachValidator < Validator attr_reader :attributes @@ -161,14 +161,13 @@ module ActiveModel #:nodoc: # Hook method that gets called by the initializer allowing verification # that the arguments supplied are valid. You could for example raise an - # ArgumentError when invalid options are supplied. + # +ArgumentError+ when invalid options are supplied. def check_validity! end end - # BlockValidator is a special EachValidator which receives a block on initialization - # and call this block for each attribute being validated. +validates_each+ uses this - # Validator. + # +BlockValidator+ is a special +EachValidator+ which receives a block on initialization + # and call this block for each attribute being validated. +validates_each+ uses this validator. class BlockValidator < EachValidator def initialize(options, &block) @block = block -- cgit v1.2.3