diff options
Diffstat (limited to 'activemodel/lib')
10 files changed, 19 insertions, 19 deletions
diff --git a/activemodel/lib/active_model/mass_assignment_security/permission_set.rb b/activemodel/lib/active_model/mass_assignment_security/permission_set.rb index 415ab0ad17..f104d0306c 100644 --- a/activemodel/lib/active_model/mass_assignment_security/permission_set.rb +++ b/activemodel/lib/active_model/mass_assignment_security/permission_set.rb @@ -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) diff --git a/activemodel/lib/active_model/validations/acceptance.rb b/activemodel/lib/active_model/validations/acceptance.rb index 38abd0c1fa..c49f831cae 100644 --- a/activemodel/lib/active_model/validations/acceptance.rb +++ b/activemodel/lib/active_model/validations/acceptance.rb @@ -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) diff --git a/activemodel/lib/active_model/validations/confirmation.rb b/activemodel/lib/active_model/validations/confirmation.rb index ede34d15bc..b6cf82fb19 100644 --- a/activemodel/lib/active_model/validations/confirmation.rb +++ b/activemodel/lib/active_model/validations/confirmation.rb @@ -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) diff --git a/activemodel/lib/active_model/validations/exclusion.rb b/activemodel/lib/active_model/validations/exclusion.rb index edd42d85f2..c8d7057606 100644 --- a/activemodel/lib/active_model/validations/exclusion.rb +++ b/activemodel/lib/active_model/validations/exclusion.rb @@ -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) diff --git a/activemodel/lib/active_model/validations/format.rb b/activemodel/lib/active_model/validations/format.rb index ffdf842d94..d48987c482 100644 --- a/activemodel/lib/active_model/validations/format.rb +++ b/activemodel/lib/active_model/validations/format.rb @@ -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 diff --git a/activemodel/lib/active_model/validations/inclusion.rb b/activemodel/lib/active_model/validations/inclusion.rb index 8810f2a3c1..154db5aedc 100644 --- a/activemodel/lib/active_model/validations/inclusion.rb +++ b/activemodel/lib/active_model/validations/inclusion.rb @@ -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) diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb index 64b4fe2d74..40ebe0cd2e 100644 --- a/activemodel/lib/active_model/validations/length.rb +++ b/activemodel/lib/active_model/validations/length.rb @@ -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 diff --git a/activemodel/lib/active_model/validations/numericality.rb b/activemodel/lib/active_model/validations/numericality.rb index 40b5b92b84..1069ed3906 100644 --- a/activemodel/lib/active_model/validations/numericality.rb +++ b/activemodel/lib/active_model/validations/numericality.rb @@ -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 diff --git a/activemodel/lib/active_model/validations/presence.rb b/activemodel/lib/active_model/validations/presence.rb index 018ef1e733..a7dcdbba3d 100644 --- a/activemodel/lib/active_model/validations/presence.rb +++ b/activemodel/lib/active_model/validations/presence.rb @@ -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) diff --git a/activemodel/lib/active_model/validations/with.rb b/activemodel/lib/active_model/validations/with.rb index 66cc9daa2c..3158f36b6e 100644 --- a/activemodel/lib/active_model/validations/with.rb +++ b/activemodel/lib/active_model/validations/with.rb @@ -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 |