mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
add :nodoc: to internal implementations [ci skip]
This commit is contained in:
parent
2a7cfee13e
commit
65362af7a8
10 changed files with 19 additions and 19 deletions
|
@ -2,7 +2,7 @@ require 'set'
|
|||
|
||||
module ActiveModel
|
||||
module MassAssignmentSecurity
|
||||
class PermissionSet < Set
|
||||
class PermissionSet < Set #:nodoc:
|
||||
|
||||
def +(values)
|
||||
super(values.compact.map(&:to_s))
|
||||
|
@ -23,14 +23,14 @@ module ActiveModel
|
|||
end
|
||||
end
|
||||
|
||||
class WhiteList < PermissionSet
|
||||
class WhiteList < PermissionSet #:nodoc:
|
||||
|
||||
def deny?(key)
|
||||
!include?(key)
|
||||
end
|
||||
end
|
||||
|
||||
class BlackList < PermissionSet
|
||||
class BlackList < PermissionSet #:nodoc:
|
||||
|
||||
def deny?(key)
|
||||
include?(key)
|
||||
|
|
|
@ -2,7 +2,7 @@ module ActiveModel
|
|||
|
||||
# == Active Model Acceptance Validator
|
||||
module Validations
|
||||
class AcceptanceValidator < EachValidator
|
||||
class AcceptanceValidator < EachValidator #:nodoc:
|
||||
def initialize(options)
|
||||
super(options.reverse_merge(:allow_nil => true, :accept => "1"))
|
||||
end
|
||||
|
@ -58,7 +58,7 @@ module ActiveModel
|
|||
# <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>).
|
||||
# The method, proc or string should return or evaluate to a true or
|
||||
# false value.
|
||||
# * <tt>:strict</tt> - Specifies whether validation should be strict.
|
||||
# * <tt>:strict</tt> - Specifies whether validation should be strict.
|
||||
# See <tt>ActiveModel::Validation#validates!</tt> for more information.
|
||||
def validates_acceptance_of(*attr_names)
|
||||
validates_with AcceptanceValidator, _merge_attributes(attr_names)
|
||||
|
|
|
@ -2,7 +2,7 @@ module ActiveModel
|
|||
|
||||
# == Active Model Confirmation Validator
|
||||
module Validations
|
||||
class ConfirmationValidator < EachValidator
|
||||
class ConfirmationValidator < EachValidator #:nodoc:
|
||||
def validate_each(record, attribute, value)
|
||||
if (confirmed = record.send("#{attribute}_confirmation")) && (value != confirmed)
|
||||
human_attribute_name = record.class.human_attribute_name(attribute)
|
||||
|
@ -59,7 +59,7 @@ module ActiveModel
|
|||
# <tt>:unless => :skip_validation</tt>, or
|
||||
# <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>). The
|
||||
# method, proc or string should return or evaluate to a true or false value.
|
||||
# * <tt>:strict</tt> - Specifies whether validation should be strict.
|
||||
# * <tt>:strict</tt> - Specifies whether validation should be strict.
|
||||
# See <tt>ActiveModel::Validation#validates!</tt> for more information.
|
||||
def validates_confirmation_of(*attr_names)
|
||||
validates_with ConfirmationValidator, _merge_attributes(attr_names)
|
||||
|
|
|
@ -4,7 +4,7 @@ module ActiveModel
|
|||
|
||||
# == Active Model Exclusion Validator
|
||||
module Validations
|
||||
class ExclusionValidator < EachValidator
|
||||
class ExclusionValidator < EachValidator #:nodoc:
|
||||
include Clusivity
|
||||
|
||||
def validate_each(record, attribute, value)
|
||||
|
|
|
@ -2,7 +2,7 @@ module ActiveModel
|
|||
|
||||
# == Active Model Format Validator
|
||||
module Validations
|
||||
class FormatValidator < EachValidator
|
||||
class FormatValidator < EachValidator #:nodoc:
|
||||
def validate_each(record, attribute, value)
|
||||
if options[:with]
|
||||
regexp = option_call(record, :with)
|
||||
|
@ -32,12 +32,12 @@ module ActiveModel
|
|||
def record_error(record, attribute, name, value)
|
||||
record.errors.add(attribute, :invalid, options.except(name).merge!(:value => value))
|
||||
end
|
||||
|
||||
|
||||
def regexp_using_multiline_anchors?(regexp)
|
||||
regexp.source.start_with?("^") ||
|
||||
(regexp.source.end_with?("$") && !regexp.source.end_with?("\\$"))
|
||||
end
|
||||
|
||||
|
||||
def check_options_validity(options, name)
|
||||
option = options[name]
|
||||
if option && !option.is_a?(Regexp) && !option.respond_to?(:call)
|
||||
|
@ -110,7 +110,7 @@ module ActiveModel
|
|||
# if the validation should not occur (e.g. <tt>:unless => :skip_validation</tt>,
|
||||
# or <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>). The
|
||||
# method, proc or string should return or evaluate to a true or false value.
|
||||
# * <tt>:strict</tt> - Specifies whether validation should be strict.
|
||||
# * <tt>:strict</tt> - Specifies whether validation should be strict.
|
||||
# See <tt>ActiveModel::Validation#validates!</tt> for more information.
|
||||
# * <tt>:multiline</tt> - Set to true if your regular expression contains
|
||||
# anchors that match the beginning or end of lines as opposed to the
|
||||
|
|
|
@ -4,7 +4,7 @@ module ActiveModel
|
|||
|
||||
# == Active Model Inclusion Validator
|
||||
module Validations
|
||||
class InclusionValidator < EachValidator
|
||||
class InclusionValidator < EachValidator #:nodoc:
|
||||
include Clusivity
|
||||
|
||||
def validate_each(record, attribute, value)
|
||||
|
|
|
@ -2,7 +2,7 @@ module ActiveModel
|
|||
|
||||
# == Active Model Length Validator
|
||||
module Validations
|
||||
class LengthValidator < EachValidator
|
||||
class LengthValidator < EachValidator #:nodoc:
|
||||
MESSAGES = { :is => :wrong_length, :minimum => :too_short, :maximum => :too_long }.freeze
|
||||
CHECKS = { :is => :==, :minimum => :>=, :maximum => :<= }.freeze
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ module ActiveModel
|
|||
|
||||
# == Active Model Numericality Validator
|
||||
module Validations
|
||||
class NumericalityValidator < EachValidator
|
||||
class NumericalityValidator < EachValidator #:nodoc:
|
||||
CHECKS = { :greater_than => :>, :greater_than_or_equal_to => :>=,
|
||||
:equal_to => :==, :less_than => :<, :less_than_or_equal_to => :<=,
|
||||
:odd => :odd?, :even => :even?, :other_than => :!= }.freeze
|
||||
|
|
|
@ -4,7 +4,7 @@ module ActiveModel
|
|||
|
||||
# == Active Model Presence Validator
|
||||
module Validations
|
||||
class PresenceValidator < EachValidator
|
||||
class PresenceValidator < EachValidator #:nodoc:
|
||||
def validate(record)
|
||||
record.errors.add_on_blank(attributes, options)
|
||||
end
|
||||
|
@ -40,7 +40,7 @@ module ActiveModel
|
|||
# if the validation should not occur (e.g. <tt>:unless => :skip_validation</tt>,
|
||||
# or <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>). The method,
|
||||
# proc or string should return or evaluate to a true or false value.
|
||||
# * <tt>:strict</tt> - Specifies whether validation should be strict.
|
||||
# * <tt>:strict</tt> - Specifies whether validation should be strict.
|
||||
# See <tt>ActiveModel::Validation#validates!</tt> for more information.
|
||||
def validates_presence_of(*attr_names)
|
||||
validates_with PresenceValidator, _merge_attributes(attr_names)
|
||||
|
|
|
@ -8,7 +8,7 @@ module ActiveModel
|
|||
end
|
||||
end
|
||||
|
||||
class WithValidator < EachValidator
|
||||
class WithValidator < EachValidator #:nodoc:
|
||||
def validate_each(record, attr, val)
|
||||
method_name = options[:with]
|
||||
|
||||
|
@ -61,7 +61,7 @@ module ActiveModel
|
|||
# (e.g. <tt>:unless => :skip_validation</tt>, or
|
||||
# <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>).
|
||||
# The method, proc or string should return or evaluate to a true or false value.
|
||||
# * <tt>:strict</tt> - Specifies whether validation should be strict.
|
||||
# * <tt>:strict</tt> - Specifies whether validation should be strict.
|
||||
# See <tt>ActiveModel::Validation#validates!</tt> for more information.
|
||||
#
|
||||
# If you pass any additional configuration options, they will be passed
|
||||
|
|
Loading…
Reference in a new issue