Skip to content

Commit

Permalink
Hiding self.include from RDoc, and final small touches.
Browse files Browse the repository at this point in the history
  • Loading branch information
grimen committed Oct 2, 2009
1 parent 98c9701 commit 3525830
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/validation_reflection.rb
Expand Up @@ -53,7 +53,7 @@ module ValidationReflection # :nodoc:
mattr_accessor :reflected_validations,
:in_ignored_subvalidation

def included(base)
def included(base) # :nodoc:
return if base.kind_of?(::ActiveRecordExtensions::ValidationReflection::ClassMethods)
base.extend(ClassMethods)
end
Expand All @@ -76,7 +76,7 @@ def load_config
#
def install(base)
@@reflected_validations.each do |validation_type|
next if base.respond_to?("#{validation_type}_with_reflection")
next if base.respond_to?(:"#{validation_type}_with_reflection")
ignore_subvalidations = false

if validation_type.kind_of?(::Hash)
Expand Down Expand Up @@ -105,14 +105,13 @@ module ClassMethods

# Returns an array of MacroReflection objects for all validations in the class
def reflect_on_all_validations
read_inheritable_attribute(:validations) || []
self.read_inheritable_attribute(:validations) || []
end

# Returns an array of MacroReflection objects for all validations defined for the field +attr_name+.
def reflect_on_validations_for(attr_name)
attr_name = attr_name.to_sym
self.reflect_on_all_validations.select do |reflection|
reflection.name == attr_name
reflection.name == attr_name.to_sym
end
end

Expand Down

0 comments on commit 3525830

Please sign in to comment.