Skip to content

Commit

Permalink
Fix rdoc syntax for Kernel.Float (#46860)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzak committed Dec 31, 2022
1 parent e6f12f5 commit 9de0d59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions activemodel/lib/active_model/validations/numericality.rb
Expand Up @@ -148,10 +148,11 @@ def record_attribute_changed_in_place?(record, attr_name)

module HelperMethods
# Validates whether the value of the specified attribute is numeric by
# trying to convert it to a float with Kernel.Float (if <tt>only_integer</tt>
# is +false+) or applying it to the regular expression <tt>/\A[\+\-]?\d+\z/</tt>
# (if <tt>only_integer</tt> is set to +true+). Precision of Kernel.Float values
# are guaranteed up to 15 digits.
# trying to convert it to a float with +Kernel.Float+ (if
# <tt>only_integer</tt> is +false+) or applying it to the regular
# expression <tt>/\A[\+\-]?\d+\z/</tt> (if <tt>only_integer</tt> is set to
# +true+). Precision of +Kernel.Float+ values are guaranteed up to 15
# digits.
#
# class Person < ActiveRecord::Base
# validates_numericality_of :value, on: :create
Expand Down
9 changes: 5 additions & 4 deletions activerecord/lib/active_record/validations/numericality.rb
Expand Up @@ -21,10 +21,11 @@ def column_scale_for(record, attribute)

module ClassMethods
# Validates whether the value of the specified attribute is numeric by
# trying to convert it to a float with Kernel.Float (if <tt>only_integer</tt>
# is +false+) or applying it to the regular expression <tt>/\A[\+\-]?\d+\z/</tt>
# (if <tt>only_integer</tt> is set to +true+). Kernel.Float precision
# defaults to the column's precision value or 15.
# trying to convert it to a float with +Kernel.Float+ (if
# <tt>only_integer</tt> is +false+) or applying it to the regular
# expression <tt>/\A[\+\-]?\d+\z/</tt> (if <tt>only_integer</tt> is set to
# +true+). +Kernel.Float+ precision defaults to the column's precision
# value or 15.
#
# See ActiveModel::Validations::HelperMethods.validates_numericality_of for more information.
def validates_numericality_of(*attr_names)
Expand Down

0 comments on commit 9de0d59

Please sign in to comment.