Add Oxford commas [ci-skip]

This commit is contained in:
Jonathan Hefner 2022-02-18 17:16:04 -06:00
parent 07bee949c4
commit e37adfed4e
53 changed files with 105 additions and 105 deletions

View File

@ -86,7 +86,7 @@ module ActionCable
# end # end
# #
# +connect+ accepts additional information about the HTTP request with the # +connect+ accepts additional information about the HTTP request with the
# +params+, +headers+, +session+ and Rack +env+ options. # +params+, +headers+, +session+, and Rack +env+ options.
# #
# def test_connect_with_headers_and_query_string # def test_connect_with_headers_and_query_string
# connect params: { user_id: 1 }, headers: { "X-API-TOKEN" => "secret-my" } # connect params: { user_id: 1 }, headers: { "X-API-TOKEN" => "secret-my" }

View File

@ -106,7 +106,7 @@ module ActionMailer
# You got a new note! # You got a new note!
# <%= truncate(@note.body, length: 25) %> # <%= truncate(@note.body, length: 25) %>
# #
# If you need to access the subject, from or the recipients in the view, you can do that through message object: # If you need to access the subject, from, or the recipients in the view, you can do that through message object:
# #
# You got a new note from <%= message.from %>! # You got a new note from <%= message.from %>!
# <%= truncate(@note.body, length: 25) %> # <%= truncate(@note.body, length: 25) %>
@ -493,28 +493,28 @@ module ActionMailer
end end
# Register an Observer which will be notified when mail is delivered. # Register an Observer which will be notified when mail is delivered.
# Either a class, string or symbol can be passed in as the Observer. # Either a class, string, or symbol can be passed in as the Observer.
# If a string or symbol is passed in it will be camelized and constantized. # If a string or symbol is passed in it will be camelized and constantized.
def register_observer(observer) def register_observer(observer)
Mail.register_observer(observer_class_for(observer)) Mail.register_observer(observer_class_for(observer))
end end
# Unregister a previously registered Observer. # Unregister a previously registered Observer.
# Either a class, string or symbol can be passed in as the Observer. # Either a class, string, or symbol can be passed in as the Observer.
# If a string or symbol is passed in it will be camelized and constantized. # If a string or symbol is passed in it will be camelized and constantized.
def unregister_observer(observer) def unregister_observer(observer)
Mail.unregister_observer(observer_class_for(observer)) Mail.unregister_observer(observer_class_for(observer))
end end
# Register an Interceptor which will be called before mail is sent. # Register an Interceptor which will be called before mail is sent.
# Either a class, string or symbol can be passed in as the Interceptor. # Either a class, string, or symbol can be passed in as the Interceptor.
# If a string or symbol is passed in it will be camelized and constantized. # If a string or symbol is passed in it will be camelized and constantized.
def register_interceptor(interceptor) def register_interceptor(interceptor)
Mail.register_interceptor(observer_class_for(interceptor)) Mail.register_interceptor(observer_class_for(interceptor))
end end
# Unregister a previously registered Interceptor. # Unregister a previously registered Interceptor.
# Either a class, string or symbol can be passed in as the Interceptor. # Either a class, string, or symbol can be passed in as the Interceptor.
# If a string or symbol is passed in it will be camelized and constantized. # If a string or symbol is passed in it will be camelized and constantized.
def unregister_interceptor(interceptor) def unregister_interceptor(interceptor)
Mail.unregister_interceptor(observer_class_for(interceptor)) Mail.unregister_interceptor(observer_class_for(interceptor))

View File

@ -5,7 +5,7 @@ require "active_support/security_utils"
require "active_support/core_ext/array/access" require "active_support/core_ext/array/access"
module ActionController module ActionController
# HTTP Basic, Digest and Token authentication. # HTTP Basic, Digest, and Token authentication.
module HttpAuthentication module HttpAuthentication
# HTTP \Basic authentication. # HTTP \Basic authentication.
# #
@ -301,7 +301,7 @@ module ActionController
# #
# An implementation might choose not to accept a previously used nonce or a previously used digest, in order to # An implementation might choose not to accept a previously used nonce or a previously used digest, in order to
# protect against a replay attack. Or, an implementation might choose to use one-time nonces or digests for # protect against a replay attack. Or, an implementation might choose to use one-time nonces or digests for
# POST, PUT, or PATCH requests and a time-stamp for GET requests. For more details on the issues involved see Section 4 # POST, PUT, or PATCH requests, and a time-stamp for GET requests. For more details on the issues involved see Section 4
# of this document. # of this document.
# #
# The nonce is opaque to the client. Composed of Time, and hash of Time with secret # The nonce is opaque to the client. Composed of Time, and hash of Time with secret

View File

@ -72,7 +72,7 @@ module ActionController # :nodoc:
# variables set in the template to be used in the layout, they won't # variables set in the template to be used in the layout, they won't
# work once you move to streaming. The proper way to communicate # work once you move to streaming. The proper way to communicate
# between layout and template, regardless of whether you use streaming # between layout and template, regardless of whether you use streaming
# or not, is by using +content_for+, +provide+ and +yield+. # or not, is by using +content_for+, +provide+, and +yield+.
# #
# Take a simple example where the layout expects the template to tell # Take a simple example where the layout expects the template to tell
# which title to use: # which title to use:
@ -132,7 +132,7 @@ module ActionController # :nodoc:
# That said, when streaming, you need to properly check your templates # That said, when streaming, you need to properly check your templates
# and choose when to use +provide+ and +content_for+. # and choose when to use +provide+ and +content_for+.
# #
# == Headers, cookies, session and flash # == Headers, cookies, session, and flash
# #
# When streaming, the HTTP headers are sent to the client right before # When streaming, the HTTP headers are sent to the client right before
# it renders the first line. This means that, modifying headers, cookies, # it renders the first line. This means that, modifying headers, cookies,

View File

@ -8,7 +8,7 @@ module ActionController
# URL options like the +host+. In order to do so, this module requires the host class # URL options like the +host+. In order to do so, this module requires the host class
# to implement +env+ which needs to be Rack-compatible and +request+ # to implement +env+ which needs to be Rack-compatible and +request+
# which is either an instance of +ActionDispatch::Request+ or an object # which is either an instance of +ActionDispatch::Request+ or an object
# that responds to the +host+, +optional_port+, +protocol+ and # that responds to the +host+, +optional_port+, +protocol+, and
# +symbolized_path_parameter+ methods. # +symbolized_path_parameter+ methods.
# #
# class RootUrl # class RootUrl

View File

@ -241,7 +241,7 @@ module ActionController
# == Basic example # == Basic example
# #
# Functional tests are written as follows: # Functional tests are written as follows:
# 1. First, one uses the +get+, +post+, +patch+, +put+, +delete+ or +head+ method to simulate # 1. First, one uses the +get+, +post+, +patch+, +put+, +delete+, or +head+ method to simulate
# an HTTP request. # an HTTP request.
# 2. Then, one asserts whether the current state is as expected. "State" can be anything: # 2. Then, one asserts whether the current state is as expected. "State" can be anything:
# the controller's HTTP response, the database contents, etc. # the controller's HTTP response, the database contents, etc.
@ -391,7 +391,7 @@ module ActionController
# #
# You can also simulate POST, PATCH, PUT, DELETE, and HEAD requests with # You can also simulate POST, PATCH, PUT, DELETE, and HEAD requests with
# +post+, +patch+, +put+, +delete+, and +head+. # +post+, +patch+, +put+, +delete+, and +head+.
# Example sending parameters, session and setting a flash message: # Example sending parameters, session, and setting a flash message:
# #
# get :show, # get :show,
# params: { id: 7 }, # params: { id: 7 },
@ -461,7 +461,7 @@ module ActionController
# session: { user_id: 1 }, # session: { user_id: 1 },
# flash: { notice: 'This is flash message' } # flash: { notice: 'This is flash message' }
# #
# To simulate +GET+, +POST+, +PATCH+, +PUT+, +DELETE+ and +HEAD+ requests # To simulate +GET+, +POST+, +PATCH+, +PUT+, +DELETE+, and +HEAD+ requests
# prefer using #get, #post, #patch, #put, #delete and #head methods # prefer using #get, #post, #patch, #put, #delete and #head methods
# respectively which will make tests more expressive. # respectively which will make tests more expressive.
# #

View File

@ -298,7 +298,7 @@ module ActionDispatch
ACTION_DISPATCH_REQUEST_ID = "action_dispatch.request_id" # :nodoc: ACTION_DISPATCH_REQUEST_ID = "action_dispatch.request_id" # :nodoc:
# Returns the unique request id, which is based on either the X-Request-Id header that can # Returns the unique request id, which is based on either the X-Request-Id header that can
# be generated by a firewall, load balancer, or web server or by the RequestId middleware # be generated by a firewall, load balancer, or web server, or by the RequestId middleware
# (which sets the action_dispatch.request_id environment variable). # (which sets the action_dispatch.request_id environment variable).
# #
# This unique ID is useful for tracing a request from end-to-end as part of logging or debugging. # This unique ID is useful for tracing a request from end-to-end as part of logging or debugging.

View File

@ -28,7 +28,7 @@ module ActionDispatch
# #
# Resource routing allows you to quickly declare all of the common routes # Resource routing allows you to quickly declare all of the common routes
# for a given resourceful controller. Instead of declaring separate routes # for a given resourceful controller. Instead of declaring separate routes
# for your +index+, +show+, +new+, +edit+, +create+, +update+ and +destroy+ # for your +index+, +show+, +new+, +edit+, +create+, +update+, and +destroy+
# actions, a resourceful route declares them in a single line of code: # actions, a resourceful route declares them in a single line of code:
# #
# resources :photos # resources :photos

View File

@ -390,10 +390,10 @@ module ActionDispatch
# #
# If you want to expose your action to both GET and POST, use: # If you want to expose your action to both GET and POST, use:
# #
# # sets :controller, :action and :id in params # # sets :controller, :action, and :id in params
# match ':controller/:action/:id', via: [:get, :post] # match ':controller/:action/:id', via: [:get, :post]
# #
# Note that +:controller+, +:action+ and +:id+ are interpreted as URL # Note that +:controller+, +:action+, and +:id+ are interpreted as URL
# query parameters and thus available through +params+ in an action. # query parameters and thus available through +params+ in an action.
# #
# If you want to expose your action to GET, use +get+ in the router: # If you want to expose your action to GET, use +get+ in the router:
@ -906,7 +906,7 @@ module ActionDispatch
# #
# === Options # === Options
# #
# The +:path+, +:as+, +:module+, +:shallow_path+ and +:shallow_prefix+ # The +:path+, +:as+, +:module+, +:shallow_path+, and +:shallow_prefix+
# options all default to the name of the namespace. # options all default to the name of the namespace.
# #
# For options, see <tt>Base#match</tt>. For +:shallow_path+ option, see # For options, see <tt>Base#match</tt>. For +:shallow_path+ option, see
@ -1082,7 +1082,7 @@ module ActionDispatch
# Resource routing allows you to quickly declare all of the common routes # Resource routing allows you to quickly declare all of the common routes
# for a given resourceful controller. Instead of declaring separate routes # for a given resourceful controller. Instead of declaring separate routes
# for your +index+, +show+, +new+, +edit+, +create+, +update+ and +destroy+ # for your +index+, +show+, +new+, +edit+, +create+, +update+, and +destroy+
# actions, a resourceful route declares them in a single line of code: # actions, a resourceful route declares them in a single line of code:
# #
# resources :photos # resources :photos

View File

@ -70,7 +70,7 @@ module ActionDispatch
# resources :users # resources :users
# #
# This generates, among other things, the method <tt>users_path</tt>. By default, # This generates, among other things, the method <tt>users_path</tt>. By default,
# this method is accessible from your controllers, views and mailers. If you need # this method is accessible from your controllers, views, and mailers. If you need
# to access this auto-generated method from other places (such as a model), then # to access this auto-generated method from other places (such as a model), then
# you can do that by including Rails.application.routes.url_helpers in your class: # you can do that by including Rails.application.routes.url_helpers in your class:
# #
@ -115,7 +115,7 @@ module ActionDispatch
default_url_options default_url_options
end end
# Generate a URL based on the options provided, default_url_options and the # Generate a URL based on the options provided, default_url_options, and the
# routes defined in routes.rb. The following options are supported: # routes defined in routes.rb. The following options are supported:
# #
# * <tt>:only_path</tt> - If true, the relative URL is returned. Defaults to +false+. # * <tt>:only_path</tt> - If true, the relative URL is returned. Defaults to +false+.
@ -154,7 +154,7 @@ module ActionDispatch
# # => '/myapp/tasks/testing' # # => '/myapp/tasks/testing'
# #
# Missing routes keys may be filled in from the current request's parameters # Missing routes keys may be filled in from the current request's parameters
# (e.g. +:controller+, +:action+, +:id+ and any other parameters that are # (e.g. +:controller+, +:action+, +:id+, and any other parameters that are
# placed in the path). Given that the current action has been reached # placed in the path). Given that the current action has been reached
# through <tt>GET /users/1</tt>: # through <tt>GET /users/1</tt>:
# #

View File

@ -26,7 +26,7 @@ module ActionView
MINUTES_IN_QUARTER_YEAR = 131400 MINUTES_IN_QUARTER_YEAR = 131400
MINUTES_IN_THREE_QUARTERS_YEAR = 394200 MINUTES_IN_THREE_QUARTERS_YEAR = 394200
# Reports the approximate distance in time between two Time, Date or DateTime objects or integers as seconds. # Reports the approximate distance in time between two Time, Date, or DateTime objects or integers as seconds.
# Pass <tt>include_seconds: true</tt> if you want more detailed approximations when distance < 1 min, 29 secs. # Pass <tt>include_seconds: true</tt> if you want more detailed approximations when distance < 1 min, 29 secs.
# Distances are reported based on the following table: # Distances are reported based on the following table:
# #
@ -291,12 +291,12 @@ module ActionView
Tags::DateSelect.new(object_name, method, self, options, html_options).render Tags::DateSelect.new(object_name, method, self, options, html_options).render
end end
# Returns a set of select tags (one for hour, minute and optionally second) pre-selected for accessing a # Returns a set of select tags (one for hour, minute, and optionally second) pre-selected for accessing a
# specified time-based attribute (identified by +method+) on an object assigned to the template (identified by # specified time-based attribute (identified by +method+) on an object assigned to the template (identified by
# +object+). You can include the seconds with <tt>:include_seconds</tt>. You can get hours in the AM/PM format # +object+). You can include the seconds with <tt>:include_seconds</tt>. You can get hours in the AM/PM format
# with <tt>:ampm</tt> option. # with <tt>:ampm</tt> option.
# #
# This method will also generate 3 input hidden tags, for the actual year, month and day unless the option # This method will also generate 3 input hidden tags, for the actual year, month, and day unless the option
# <tt>:ignore_date</tt> is set to +true+. If you set the <tt>:ignore_date</tt> to +true+, you must have a # <tt>:ignore_date</tt> is set to +true+. If you set the <tt>:ignore_date</tt> to +true+, you must have a
# +date_select+ on the same method within the form otherwise an exception will be raised. # +date_select+ on the same method within the form otherwise an exception will be raised.
# #

View File

@ -9,7 +9,7 @@ module ActionView
module Helpers # :nodoc: module Helpers # :nodoc:
# Provides methods for converting numbers into formatted strings. # Provides methods for converting numbers into formatted strings.
# Methods are provided for phone numbers, currency, percentage, # Methods are provided for phone numbers, currency, percentage,
# precision, positional notation, file size and pretty printing. # precision, positional notation, file size, and pretty printing.
# #
# Most methods expect a +number+ argument, and will return it # Most methods expect a +number+ argument, and will return it
# unchanged if can't be converted into a valid number. # unchanged if can't be converted into a valid number.

View File

@ -208,7 +208,7 @@ module ActionView
# #
# Thus <tt>data-user-id</tt> can be accessed as <tt>dataset.userId</tt>. # Thus <tt>data-user-id</tt> can be accessed as <tt>dataset.userId</tt>.
# #
# Data attribute values are encoded to JSON, with the exception of strings, symbols and # Data attribute values are encoded to JSON, with the exception of strings, symbols, and
# BigDecimals. # BigDecimals.
# This may come in handy when using jQuery's HTML5-aware <tt>.data()</tt> # This may come in handy when using jQuery's HTML5-aware <tt>.data()</tt>
# from 1.4.3. # from 1.4.3.

View File

@ -255,7 +255,7 @@ module ActionView
# true:: raise an ArgumentError # true:: raise an ArgumentError
# nil:: Force default layout behavior with inheritance # nil:: Force default layout behavior with inheritance
# #
# Return value of +Proc+ and +Symbol+ arguments should be +String+, +false+, +true+ or +nil+ # Return value of +Proc+ and +Symbol+ arguments should be +String+, +false+, +true+, or +nil+
# with the same meaning as described above. # with the same meaning as described above.
# #
# ==== Parameters # ==== Parameters

View File

@ -18,7 +18,7 @@ module ActiveJob
# currently support String, Integer, Float, NilClass, TrueClass, FalseClass, # currently support String, Integer, Float, NilClass, TrueClass, FalseClass,
# BigDecimal, Symbol, Date, Time, DateTime, ActiveSupport::TimeWithZone, # BigDecimal, Symbol, Date, Time, DateTime, ActiveSupport::TimeWithZone,
# ActiveSupport::Duration, Hash, ActiveSupport::HashWithIndifferentAccess, # ActiveSupport::Duration, Hash, ActiveSupport::HashWithIndifferentAccess,
# Array, Range or GlobalID::Identification instances, although this can be # Array, Range, or GlobalID::Identification instances, although this can be
# extended by adding custom serializers. # extended by adding custom serializers.
# Raised if you set the key for a Hash something else than a string or # Raised if you set the key for a Hash something else than a string or
# a symbol. Also raised when trying to serialize an object which can't be # a symbol. Also raised when trying to serialize an object which can't be

View File

@ -17,7 +17,7 @@ module ActiveJob
# Push a job onto the queue. By default the arguments must be either String, # Push a job onto the queue. By default the arguments must be either String,
# Integer, Float, NilClass, TrueClass, FalseClass, BigDecimal, Symbol, Date, # Integer, Float, NilClass, TrueClass, FalseClass, BigDecimal, Symbol, Date,
# Time, DateTime, ActiveSupport::TimeWithZone, ActiveSupport::Duration, # Time, DateTime, ActiveSupport::TimeWithZone, ActiveSupport::Duration,
# Hash, ActiveSupport::HashWithIndifferentAccess, Array, Range or # Hash, ActiveSupport::HashWithIndifferentAccess, Array, Range, or
# GlobalID::Identification instances, although this can be extended by adding # GlobalID::Identification instances, although this can be extended by adding
# custom serializers. # custom serializers.
# #

View File

@ -109,7 +109,7 @@ module ActiveJob
# end # end
# end # end
# #
# +:only+ and +:except+ options accept Class, Array of Class or Proc. When passed a Proc, # +:only+ and +:except+ options accept Class, Array of Class, or Proc. When passed a Proc,
# a hash containing the job's class and it's argument are passed as argument. # a hash containing the job's class and it's argument are passed as argument.
# #
# Asserts the number of times a job is enqueued to a specific queue by passing +:queue+ option. # Asserts the number of times a job is enqueued to a specific queue by passing +:queue+ option.
@ -168,7 +168,7 @@ module ActiveJob
# end # end
# end # end
# #
# +:only+ and +:except+ options accept Class, Array of Class or Proc. When passed a Proc, # +:only+ and +:except+ options accept Class, Array of Class, or Proc. When passed a Proc,
# a hash containing the job's class and it's argument are passed as argument. # a hash containing the job's class and it's argument are passed as argument.
# #
# Asserts that no jobs are enqueued to a specific queue by passing +:queue+ option # Asserts that no jobs are enqueued to a specific queue by passing +:queue+ option
@ -325,7 +325,7 @@ module ActiveJob
# end # end
# end # end
# #
# +:only+ and +:except+ options accept Class, Array of Class or Proc. When passed a Proc, # +:only+ and +:except+ options accept Class, Array of Class, or Proc. When passed a Proc,
# an instance of the job will be passed as argument. # an instance of the job will be passed as argument.
# #
# If the +:queue+ option is specified, # If the +:queue+ option is specified,
@ -579,7 +579,7 @@ module ActiveJob
# assert_performed_jobs 1 # assert_performed_jobs 1
# end # end
# #
# +:only+ and +:except+ options accept Class, Array of Class or Proc. When passed a Proc, # +:only+ and +:except+ options accept Class, Array of Class, or Proc. When passed a Proc,
# an instance of the job will be passed as argument. # an instance of the job will be passed as argument.
# #
# If the +:queue+ option is specified, # If the +:queue+ option is specified,

View File

@ -5,7 +5,7 @@ module ActiveModel
# #
# Includes the required interface for an object to interact with # Includes the required interface for an object to interact with
# Action Pack and Action View, using different Active Model modules. # Action Pack and Action View, using different Active Model modules.
# It includes model name introspections, conversions, translations and # It includes model name introspections, conversions, translations, and
# validations. Besides that, it allows you to initialize the object with a # validations. Besides that, it allows you to initialize the object with a
# hash of attributes, pretty much like Active Record does. # hash of attributes, pretty much like Active Record does.
# #

View File

@ -253,7 +253,7 @@ module ActiveModel
# <tt>ActiveModel::AttributeMethods</tt>. # <tt>ActiveModel::AttributeMethods</tt>.
# #
# To use, pass attribute names (as strings or symbols). Be sure to declare # To use, pass attribute names (as strings or symbols). Be sure to declare
# +define_attribute_methods+ after you define any prefix, suffix or affix # +define_attribute_methods+ after you define any prefix, suffix, or affix
# methods, or they will not hook in. # methods, or they will not hook in.
# #
# class Person # class Person

View File

@ -32,7 +32,7 @@ module ActiveModel
# end # end
# end # end
# #
# Then in your class, you can use the +before_create+, +after_create+ and # Then in your class, you can use the +before_create+, +after_create+, and
# +around_create+ methods, just as you would in an Active Record model. # +around_create+ methods, just as you would in an Active Record model.
# #
# before_create :action_before_create # before_create :action_before_create
@ -84,7 +84,7 @@ module ActiveModel
# define_model_callbacks :update, only: :before # define_model_callbacks :update, only: :before
# define_model_callbacks :destroy, only: :around # define_model_callbacks :destroy, only: :around
# #
# Would create +after_create+, +before_update+ and +around_destroy+ methods # Would create +after_create+, +before_update+, and +around_destroy+ methods
# only. # only.
# #
# You can pass in a class to before_<type>, after_<type> and around_<type>, # You can pass in a class to before_<type>, after_<type> and around_<type>,

View File

@ -159,7 +159,7 @@ module ActiveModel
self.class.full_message(attribute, message, @base) self.class.full_message(attribute, message, @base)
end end
# See if error matches provided +attribute+, +type+ and +options+. # See if error matches provided +attribute+, +type+, and +options+.
# #
# Omitted params are not checked for a match. # Omitted params are not checked for a match.
def match?(attribute, type = nil, **options) def match?(attribute, type = nil, **options)
@ -176,7 +176,7 @@ module ActiveModel
true true
end end
# See if error matches provided +attribute+, +type+ and +options+ exactly. # See if error matches provided +attribute+, +type+, and +options+ exactly.
# #
# All params must be equal to Error's own attributes to be considered a # All params must be equal to Error's own attributes to be considered a
# strict match. # strict match.

View File

@ -147,7 +147,7 @@ module ActiveModel
} }
end end
# Search for errors matching +attribute+, +type+ or +options+. # Search for errors matching +attribute+, +type+, or +options+.
# #
# Only supplied params will be matched. # Only supplied params will be matched.
# #
@ -427,7 +427,7 @@ module ActiveModel
# if it's not there, it's looked up in <tt>activemodel.errors.models.MODEL.MESSAGE</tt> and if # if it's not there, it's looked up in <tt>activemodel.errors.models.MODEL.MESSAGE</tt> and if
# that is not there also, it returns the translation of the default message # that is not there also, it returns the translation of the default message
# (e.g. <tt>activemodel.errors.messages.MESSAGE</tt>). The translated model # (e.g. <tt>activemodel.errors.messages.MESSAGE</tt>). The translated model
# name, translated attribute name and the value are available for # name, translated attribute name, and the value are available for
# interpolation. # interpolation.
# #
# When using inheritance in your models, it will check all the inherited # When using inheritance in your models, it will check all the inherited

View File

@ -73,14 +73,14 @@ module ActiveModel
# <tt>on: [:create, :custom_validation_context]</tt>) # <tt>on: [:create, :custom_validation_context]</tt>)
# * <tt>:allow_nil</tt> - Skip validation if attribute is +nil+. # * <tt>:allow_nil</tt> - Skip validation if attribute is +nil+.
# * <tt>:allow_blank</tt> - Skip validation if attribute is blank. # * <tt>:allow_blank</tt> - Skip validation if attribute is blank.
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine # * <tt>:if</tt> - Specifies a method, proc, or string to call to determine
# if the validation should occur (e.g. <tt>if: :allow_validation</tt>, # if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
# or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method, # or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method,
# proc or string should return or evaluate to a +true+ or +false+ value. # proc or string should return or evaluate to a +true+ or +false+ value.
# * <tt>:unless</tt> - Specifies a method, proc or string to call to # * <tt>:unless</tt> - Specifies a method, proc, or string to call to
# determine if the validation should not occur (e.g. <tt>unless: :skip_validation</tt>, # determine 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 # 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+ # method, proc, or string should return or evaluate to a +true+ or +false+
# value. # value.
def validates_each(*attr_names, &block) def validates_each(*attr_names, &block)
validates_with BlockValidator, _merge_attributes(attr_names), &block validates_with BlockValidator, _merge_attributes(attr_names), &block
@ -137,14 +137,14 @@ module ActiveModel
# or an array of symbols. (e.g. <tt>on: :create</tt> or # or an array of symbols. (e.g. <tt>on: :create</tt> or
# <tt>on: :custom_validation_context</tt> or # <tt>on: :custom_validation_context</tt> or
# <tt>on: [:create, :custom_validation_context]</tt>) # <tt>on: [:create, :custom_validation_context]</tt>)
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine # * <tt>:if</tt> - Specifies a method, proc, or string to call to determine
# if the validation should occur (e.g. <tt>if: :allow_validation</tt>, # if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
# or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method, # or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method,
# proc or string should return or evaluate to a +true+ or +false+ value. # proc or string should return or evaluate to a +true+ or +false+ value.
# * <tt>:unless</tt> - Specifies a method, proc or string to call to # * <tt>:unless</tt> - Specifies a method, proc, or string to call to
# determine if the validation should not occur (e.g. <tt>unless: :skip_validation</tt>, # determine 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 # 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+ # method, proc, or string should return or evaluate to a +true+ or +false+
# value. # value.
# #
# NOTE: Calling +validate+ multiple times on the same method will overwrite previous definitions. # NOTE: Calling +validate+ multiple times on the same method will overwrite previous definitions.

View File

@ -29,8 +29,8 @@ module ActiveModel
# #
# Configuration options: # Configuration options:
# * <tt>:in</tt> - An enumerable object of items that the value shouldn't # * <tt>:in</tt> - An enumerable object of items that the value shouldn't
# be part of. This can be supplied as a proc, lambda or symbol which returns an # be part of. This can be supplied as a proc, lambda, or symbol which returns an
# enumerable. If the enumerable is a numerical, time or datetime range the test # enumerable. If the enumerable is a numerical, time, or datetime range the test
# is performed with <tt>Range#cover?</tt>, otherwise with <tt>include?</tt>. When # is performed with <tt>Range#cover?</tt>, otherwise with <tt>include?</tt>. When
# using a proc or lambda the instance under validation is passed as an argument. # using a proc or lambda the instance under validation is passed as an argument.
# * <tt>:within</tt> - A synonym(or alias) for <tt>:in</tt> # * <tt>:within</tt> - A synonym(or alias) for <tt>:in</tt>

View File

@ -28,8 +28,8 @@ module ActiveModel
# #
# Configuration options: # Configuration options:
# * <tt>:in</tt> - An enumerable object of available items. This can be # * <tt>:in</tt> - An enumerable object of available items. This can be
# supplied as a proc, lambda or symbol which returns an enumerable. If the # supplied as a proc, lambda, or symbol which returns an enumerable. If the
# enumerable is a numerical, time or datetime range the test is performed # enumerable is a numerical, time, or datetime range the test is performed
# with <tt>Range#cover?</tt>, otherwise with <tt>include?</tt>. When using # with <tt>Range#cover?</tt>, otherwise with <tt>include?</tt>. When using
# a proc or lambda the instance under validation is passed as an argument. # a proc or lambda the instance under validation is passed as an argument.
# * <tt>:within</tt> - A synonym(or alias) for <tt>:in</tt> # * <tt>:within</tt> - A synonym(or alias) for <tt>:in</tt>

View File

@ -117,7 +117,7 @@ module ActiveModel
# <tt>too_long</tt>/<tt>too_short</tt>/<tt>wrong_length</tt> message. # <tt>too_long</tt>/<tt>too_short</tt>/<tt>wrong_length</tt> message.
# #
# There is also a list of default options supported by every validator: # There is also a list of default options supported by every validator:
# +:if+, +:unless+, +:on+ and +:strict+. # +:if+, +:unless+, +:on+, and +:strict+.
# See <tt>ActiveModel::Validations#validates</tt> for more information. # See <tt>ActiveModel::Validations#validates</tt> for more information.
def validates_length_of(*attr_names) def validates_length_of(*attr_names)
validates_with LengthValidator, _merge_attributes(attr_names) validates_with LengthValidator, _merge_attributes(attr_names)

View File

@ -78,14 +78,14 @@ module ActiveModel
# or an array of symbols. (e.g. <tt>on: :create</tt> or # or an array of symbols. (e.g. <tt>on: :create</tt> or
# <tt>on: :custom_validation_context</tt> or # <tt>on: :custom_validation_context</tt> or
# <tt>on: [:create, :custom_validation_context]</tt>) # <tt>on: [:create, :custom_validation_context]</tt>)
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine # * <tt>:if</tt> - Specifies a method, proc, or string to call to determine
# if the validation should occur (e.g. <tt>if: :allow_validation</tt>, # if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
# or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method, # or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method,
# proc or string should return or evaluate to a +true+ or +false+ value. # proc or string should return or evaluate to a +true+ or +false+ value.
# * <tt>:unless</tt> - Specifies a method, proc or string to call to determine # * <tt>:unless</tt> - Specifies a method, proc, or string to call to determine
# if the validation should not occur (e.g. <tt>unless: :skip_validation</tt>, # 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 # or <tt>unless: Proc.new { |user| user.signup_step <= 2 }</tt>). The
# method, proc or string should return or evaluate to a +true+ or # method, proc, or string should return or evaluate to a +true+ or
# +false+ value. # +false+ value.
# * <tt>:allow_nil</tt> - Skip validation if the attribute is +nil+. # * <tt>:allow_nil</tt> - Skip validation if the attribute is +nil+.
# * <tt>:allow_blank</tt> - Skip validation if the attribute is blank. # * <tt>:allow_blank</tt> - Skip validation if the attribute is blank.

View File

@ -51,16 +51,16 @@ module ActiveModel
# or an array of symbols. (e.g. <tt>on: :create</tt> or # or an array of symbols. (e.g. <tt>on: :create</tt> or
# <tt>on: :custom_validation_context</tt> or # <tt>on: :custom_validation_context</tt> or
# <tt>on: [:create, :custom_validation_context]</tt>) # <tt>on: [:create, :custom_validation_context]</tt>)
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine # * <tt>:if</tt> - Specifies a method, proc, or string to call to determine
# if the validation should occur (e.g. <tt>if: :allow_validation</tt>, # if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
# or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). # or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>).
# The method, proc or string should return or evaluate to a +true+ or # The method, proc, or string should return or evaluate to a +true+ or
# +false+ value. # +false+ value.
# * <tt>:unless</tt> - Specifies a method, proc or string to call to # * <tt>:unless</tt> - Specifies a method, proc, or string to call to
# determine if the validation should not occur # determine if the validation should not occur
# (e.g. <tt>unless: :skip_validation</tt>, or # (e.g. <tt>unless: :skip_validation</tt>, or
# <tt>unless: Proc.new { |user| user.signup_step <= 2 }</tt>). # <tt>unless: Proc.new { |user| user.signup_step <= 2 }</tt>).
# The method, proc or string should return or evaluate to a +true+ or # The method, proc, or string should return or evaluate to a +true+ or
# +false+ value. # +false+ value.
# * <tt>:strict</tt> - Specifies whether validation should be strict. # * <tt>:strict</tt> - Specifies whether validation should be strict.
# See <tt>ActiveModel::Validations#validates!</tt> for more information. # See <tt>ActiveModel::Validations#validates!</tt> for more information.

View File

@ -126,7 +126,7 @@ module ActiveModel
# +EachValidator+ is a validator which iterates through the attributes given # +EachValidator+ is a validator which iterates through the attributes given
# in the options hash invoking the <tt>validate_each</tt> method passing in the # in the options hash invoking the <tt>validate_each</tt> method passing in the
# record, attribute and value. # 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 class EachValidator < Validator

View File

@ -432,7 +432,7 @@ module ActiveRecord
# #
# == Cardinality and associations # == Cardinality and associations
# #
# Active Record associations can be used to describe one-to-one, one-to-many and many-to-many # Active Record associations can be used to describe one-to-one, one-to-many, and many-to-many
# relationships between models. Each model uses an association to describe its role in # relationships between models. Each model uses an association to describe its role in
# the relation. The #belongs_to association is always used in the model that has # the relation. The #belongs_to association is always used in the model that has
# the foreign key. # the foreign key.
@ -586,7 +586,7 @@ module ActiveRecord
# has_many :birthday_events, ->(user) { where(starts_on: user.birthday) }, class_name: 'Event' # has_many :birthday_events, ->(user) { where(starts_on: user.birthday) }, class_name: 'Event'
# end # end
# #
# Note: Joining, eager loading and preloading of these associations is not possible. # Note: Joining, eager loading, and preloading of these associations is not possible.
# These operations happen before instance creation and the scope will be called with a +nil+ argument. # These operations happen before instance creation and the scope will be called with a +nil+ argument.
# #
# == Association callbacks # == Association callbacks
@ -618,7 +618,7 @@ module ActiveRecord
# after_remove: :log_after_remove # after_remove: :log_after_remove
# end # end
# #
# Possible callbacks are: +before_add+, +after_add+, +before_remove+ and +after_remove+. # Possible callbacks are: +before_add+, +after_add+, +before_remove+, and +after_remove+.
# #
# If any of the +before_add+ callbacks throw an exception, the object will not be # If any of the +before_add+ callbacks throw an exception, the object will not be
# added to the collection. # added to the collection.
@ -1333,7 +1333,7 @@ module ActiveRecord
# === Extensions # === Extensions
# #
# The +extension+ argument allows you to pass a block into a has_many # The +extension+ argument allows you to pass a block into a has_many
# association. This is useful for adding new finders, creators and other # association. This is useful for adding new finders, creators, and other
# factory-type methods to be used as part of the association. # factory-type methods to be used as part of the association.
# #
# Extension examples: # Extension examples:
@ -1905,7 +1905,7 @@ module ActiveRecord
# #
# The +extension+ argument allows you to pass a block into a # The +extension+ argument allows you to pass a block into a
# has_and_belongs_to_many association. This is useful for adding new # has_and_belongs_to_many association. This is useful for adding new
# finders, creators and other factory-type methods to be used as part of # finders, creators, and other factory-type methods to be used as part of
# the association. # the association.
# #
# Extension examples: # Extension examples:

View File

@ -475,7 +475,7 @@ module ActiveRecord
# Deletes the records of the collection directly from the database # Deletes the records of the collection directly from the database
# ignoring the +:dependent+ option. Records are instantiated and it # ignoring the +:dependent+ option. Records are instantiated and it
# invokes +before_remove+, +after_remove+, +before_destroy+ and # invokes +before_remove+, +after_remove+, +before_destroy+, and
# +after_destroy+ callbacks. # +after_destroy+ callbacks.
# #
# class Person < ActiveRecord::Base # class Person < ActiveRecord::Base

View File

@ -40,7 +40,7 @@ module ActiveRecord
# but the Book model connects to a separate database called "library_db" # but the Book model connects to a separate database called "library_db"
# (this can even be a database on a different machine). # (this can even be a database on a different machine).
# #
# Book, ScaryBook and GoodBook will all use the same connection pool to # Book, ScaryBook, and GoodBook will all use the same connection pool to
# "library_db" while Author, BankAccount, and any other models you create # "library_db" while Author, BankAccount, and any other models you create
# will use the default connection pool to "my_application". # will use the default connection pool to "my_application".
# #

View File

@ -1073,9 +1073,9 @@ module ActiveRecord
# [<tt>:name</tt>] # [<tt>:name</tt>]
# The constraint name. Defaults to <tt>fk_rails_<identifier></tt>. # The constraint name. Defaults to <tt>fk_rails_<identifier></tt>.
# [<tt>:on_delete</tt>] # [<tt>:on_delete</tt>]
# Action that happens <tt>ON DELETE</tt>. Valid values are +:nullify+, +:cascade+ and +:restrict+ # Action that happens <tt>ON DELETE</tt>. Valid values are +:nullify+, +:cascade+, and +:restrict+
# [<tt>:on_update</tt>] # [<tt>:on_update</tt>]
# Action that happens <tt>ON UPDATE</tt>. Valid values are +:nullify+, +:cascade+ and +:restrict+ # Action that happens <tt>ON UPDATE</tt>. Valid values are +:nullify+, +:cascade+, and +:restrict+
# [<tt>:if_not_exists</tt>] # [<tt>:if_not_exists</tt>]
# Specifies if the foreign key already exists to not try to re-add it. This will avoid # Specifies if the foreign key already exists to not try to re-add it. This will avoid
# duplicate column errors. # duplicate column errors.

View File

@ -44,7 +44,7 @@ module ActiveRecord
# #
# ActiveRecord::Base.establish_connection(:production) # ActiveRecord::Base.establish_connection(:production)
# #
# The exceptions AdapterNotSpecified, AdapterNotFound and +ArgumentError+ # The exceptions AdapterNotSpecified, AdapterNotFound, and +ArgumentError+
# may be returned on an error. # may be returned on an error.
def establish_connection(config_or_env = nil) def establish_connection(config_or_env = nil)
config_or_env ||= DEFAULT_ENV.call.to_sym config_or_env ||= DEFAULT_ENV.call.to_sym
@ -108,7 +108,7 @@ module ActiveRecord
connections connections
end end
# Connects to a role (e.g. writing, reading or a custom role) and/or # Connects to a role (e.g. writing, reading, or a custom role) and/or
# shard for the duration of the block. At the end of the block the # shard for the duration of the block. At the end of the block the
# connection will be returned to the original role / shard. # connection will be returned to the original role / shard.
# #

View File

@ -326,7 +326,7 @@ module ActiveRecord
# details. # details.
# * <tt>change_table(name, options)</tt>: Allows to make column alterations to # * <tt>change_table(name, options)</tt>: Allows to make column alterations to
# the table called +name+. It makes the table object available to a block that # the table called +name+. It makes the table object available to a block that
# can then add/remove columns, indexes or foreign keys to it. # can then add/remove columns, indexes, or foreign keys to it.
# * <tt>rename_column(table_name, column_name, new_column_name)</tt>: Renames # * <tt>rename_column(table_name, column_name, new_column_name)</tt>: Renames
# a column but keeps the type and content. # a column but keeps the type and content.
# * <tt>rename_index(table_name, old_name, new_name)</tt>: Renames an index. # * <tt>rename_index(table_name, old_name, new_name)</tt>: Renames an index.

View File

@ -42,14 +42,14 @@ module ActiveRecord
# or an array of symbols. (e.g. <tt>on: :create</tt> or # or an array of symbols. (e.g. <tt>on: :create</tt> or
# <tt>on: :custom_validation_context</tt> or # <tt>on: :custom_validation_context</tt> or
# <tt>on: [:create, :custom_validation_context]</tt>) # <tt>on: [:create, :custom_validation_context]</tt>)
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine # * <tt>:if</tt> - Specifies a method, proc, or string to call to determine
# if the validation should occur (e.g. <tt>if: :allow_validation</tt>, # if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
# or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method, # or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method,
# proc or string should return or evaluate to a +true+ or +false+ value. # proc or string should return or evaluate to a +true+ or +false+ value.
# * <tt>:unless</tt> - Specifies a method, proc or string to call to # * <tt>:unless</tt> - Specifies a method, proc, or string to call to
# determine if the validation should not occur (e.g. <tt>unless: :skip_validation</tt>, # determine 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 # 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+ # method, proc, or string should return or evaluate to a +true+ or +false+
# value. # value.
def validates_associated(*attr_names) def validates_associated(*attr_names)
validates_with AssociatedValidator, _merge_attributes(attr_names) validates_with AssociatedValidator, _merge_attributes(attr_names)

View File

@ -50,11 +50,11 @@ module ActiveRecord
# or an array of symbols. (e.g. <tt>on: :create</tt> or # or an array of symbols. (e.g. <tt>on: :create</tt> or
# <tt>on: :custom_validation_context</tt> or # <tt>on: :custom_validation_context</tt> or
# <tt>on: [:create, :custom_validation_context]</tt>) # <tt>on: [:create, :custom_validation_context]</tt>)
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine if # * <tt>:if</tt> - Specifies a method, proc, or string to call to determine if
# the validation should occur (e.g. <tt>if: :allow_validation</tt>, or # the validation should occur (e.g. <tt>if: :allow_validation</tt>, or
# <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method, proc # <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method, proc
# or string should return or evaluate to a +true+ or +false+ value. # or string should return or evaluate to a +true+ or +false+ value.
# * <tt>:unless</tt> - Specifies a method, proc or string to call to determine # * <tt>:unless</tt> - Specifies a method, proc, or string to call to determine
# if the validation should not occur (e.g. <tt>unless: :skip_validation</tt>, # 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, # 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. # proc or string should return or evaluate to a +true+ or +false+ value.

View File

@ -166,14 +166,14 @@ module ActiveRecord
# attribute is +nil+ (default is +false+). # attribute is +nil+ (default is +false+).
# * <tt>:allow_blank</tt> - If set to +true+, skips this validation if the # * <tt>:allow_blank</tt> - If set to +true+, skips this validation if the
# attribute is blank (default is +false+). # attribute is blank (default is +false+).
# * <tt>:if</tt> - Specifies a method, proc or string to call to determine # * <tt>:if</tt> - Specifies a method, proc, or string to call to determine
# if the validation should occur (e.g. <tt>if: :allow_validation</tt>, # if the validation should occur (e.g. <tt>if: :allow_validation</tt>,
# or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method, # or <tt>if: Proc.new { |user| user.signup_step > 2 }</tt>). The method,
# proc or string should return or evaluate to a +true+ or +false+ value. # proc or string should return or evaluate to a +true+ or +false+ value.
# * <tt>:unless</tt> - Specifies a method, proc or string to call to # * <tt>:unless</tt> - Specifies a method, proc, or string to call to
# determine if the validation should not occur (e.g. <tt>unless: :skip_validation</tt>, # determine 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 # 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+ # method, proc, or string should return or evaluate to a +true+ or +false+
# value. # value.
# #
# === Concurrency and integrity # === Concurrency and integrity

View File

@ -7,7 +7,7 @@ module ActiveSupport
module NumericWithFormat module NumericWithFormat
# Provides options for converting numbers into formatted strings. # Provides options for converting numbers into formatted strings.
# Options are provided for phone numbers, currency, percentage, # Options are provided for phone numbers, currency, percentage,
# precision, positional notation, file size and pretty printing. # precision, positional notation, file size, and pretty printing.
# #
# This method is aliased to <tt>to_formatted_s</tt>. # This method is aliased to <tt>to_formatted_s</tt>.
# #

View File

@ -12,7 +12,7 @@ module SecureRandom
# #
# If _n_ is not specified or is +nil+, 16 is assumed. It may be larger in the future. # If _n_ is not specified or is +nil+, 16 is assumed. It may be larger in the future.
# #
# The result may contain alphanumeric characters except 0, O, I and l. # The result may contain alphanumeric characters except 0, O, I, and l.
# #
# p SecureRandom.base58 # => "4kUgL2pdQMSCQtjE" # p SecureRandom.base58 # => "4kUgL2pdQMSCQtjE"
# p SecureRandom.base58(24) # => "77TMHrHJFvFDwodq8w7Ev2m7" # p SecureRandom.base58(24) # => "77TMHrHJFvFDwodq8w7Ev2m7"

View File

@ -126,8 +126,8 @@ class Time
# Returns a new Time where one or more of the elements have been changed according # Returns a new Time where one or more of the elements have been changed according
# to the +options+ parameter. The time options (<tt>:hour</tt>, <tt>:min</tt>, # to the +options+ parameter. The time options (<tt>:hour</tt>, <tt>:min</tt>,
# <tt>:sec</tt>, <tt>:usec</tt>, <tt>:nsec</tt>) reset cascadingly, so if only # <tt>:sec</tt>, <tt>:usec</tt>, <tt>:nsec</tt>) reset cascadingly, so if only
# the hour is passed, then minute, sec, usec and nsec is set to 0. If the hour # the hour is passed, then minute, sec, usec, and nsec is set to 0. If the hour
# and minute is passed, then sec, usec and nsec is set to 0. The +options+ parameter # and minute is passed, then sec, usec, and nsec is set to 0. The +options+ parameter
# takes a hash with any of these keys: <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>, # takes a hash with any of these keys: <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>,
# <tt>:hour</tt>, <tt>:min</tt>, <tt>:sec</tt>, <tt>:usec</tt>, <tt>:nsec</tt>, # <tt>:hour</tt>, <tt>:min</tt>, <tt>:sec</tt>, <tt>:usec</tt>, <tt>:nsec</tt>,
# <tt>:offset</tt>. Pass either <tt>:usec</tt> or <tt>:nsec</tt>, not both. # <tt>:offset</tt>. Pass either <tt>:usec</tt> or <tt>:nsec</tt>, not both.

View File

@ -4,7 +4,7 @@ require "singleton"
module ActiveSupport module ActiveSupport
# \Deprecation specifies the API used by Rails to deprecate methods, instance # \Deprecation specifies the API used by Rails to deprecate methods, instance
# variables, objects and constants. # variables, objects, and constants.
class Deprecation class Deprecation
# active_support.rb sets an autoload for ActiveSupport::Deprecation. # active_support.rb sets an autoload for ActiveSupport::Deprecation.
# #

View File

@ -26,7 +26,7 @@ module ActiveSupport
end end
# DeprecatedObjectProxy transforms an object into a deprecated one. It # DeprecatedObjectProxy transforms an object into a deprecated one. It
# takes an object, a deprecation message and optionally a deprecator. The # takes an object, a deprecation message, and optionally a deprecator. The
# deprecator defaults to +ActiveSupport::Deprecator+ if none is specified. # deprecator defaults to +ActiveSupport::Deprecator+ if none is specified.
# #
# deprecated_object = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(Object.new, "This object is now deprecated") # deprecated_object = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(Object.new, "This object is now deprecated")

View File

@ -28,7 +28,7 @@ module ActiveSupport
# end # end
# #
# Additionally a +severity+ can be passed along to communicate how important the error report is. # Additionally a +severity+ can be passed along to communicate how important the error report is.
# +severity+ can be one of +:error+, +:warning+ or +:info+. Handled errors default to the +:warning+ # +severity+ can be one of +:error+, +:warning+, or +:info+. Handled errors default to the +:warning+
# severity, and unhandled ones to +:error+. # severity, and unhandled ones to +:error+.
# #
# Both +handle+ and +record+ pass through the return value from the block. In the case of +handle+ # Both +handle+ and +record+ pass through the return value from the block. In the case of +handle+

View File

@ -59,7 +59,7 @@ module ActiveSupport
# transliterate('Jürgen', locale: :de) # transliterate('Jürgen', locale: :de)
# # => "Juergen" # # => "Juergen"
# #
# Transliteration is restricted to UTF-8, US-ASCII and GB18030 strings. # Transliteration is restricted to UTF-8, US-ASCII, and GB18030 strings.
# Other encodings will raise an ArgumentError. # Other encodings will raise an ArgumentError.
def transliterate(string, replacement = "?", locale: nil) def transliterate(string, replacement = "?", locale: nil)
string = string.dup if string.frozen? string = string.dup if string.frozen?

View File

@ -33,7 +33,7 @@ module ActiveSupport
# The messages are available in the @logger instance, which is a logger with # The messages are available in the @logger instance, which is a logger with
# limited powers (it actually does not send anything to your output), and # limited powers (it actually does not send anything to your output), and
# you can collect them doing @logger.logged(level), where level is the level # you can collect them doing @logger.logged(level), where level is the level
# used in logging, like info, debug, warn and so on. # used in logging, like info, debug, warn, and so on.
module TestHelper module TestHelper
def setup # :nodoc: def setup # :nodoc:
@logger = MockLogger.new @logger = MockLogger.new

View File

@ -13,7 +13,7 @@ module ActiveSupport
# system's <tt>ENV['TZ']</tt> zone. # system's <tt>ENV['TZ']</tt> zone.
# #
# You shouldn't ever need to create a TimeWithZone instance directly via +new+. # You shouldn't ever need to create a TimeWithZone instance directly via +new+.
# Instead use methods +local+, +parse+, +at+ and +now+ on TimeZone instances, # Instead use methods +local+, +parse+, +at+, and +now+ on TimeZone instances,
# and +in_time_zone+ on Time and DateTime instances. # and +in_time_zone+ on Time and DateTime instances.
# #
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
@ -395,8 +395,8 @@ module ActiveSupport
# Returns a new +ActiveSupport::TimeWithZone+ where one or more of the elements have # Returns a new +ActiveSupport::TimeWithZone+ where one or more of the elements have
# been changed according to the +options+ parameter. The time options (<tt>:hour</tt>, # been changed according to the +options+ parameter. The time options (<tt>:hour</tt>,
# <tt>:min</tt>, <tt>:sec</tt>, <tt>:usec</tt>, <tt>:nsec</tt>) reset cascadingly, # <tt>:min</tt>, <tt>:sec</tt>, <tt>:usec</tt>, <tt>:nsec</tt>) reset cascadingly,
# so if only the hour is passed, then minute, sec, usec and nsec is set to 0. If the # so if only the hour is passed, then minute, sec, usec, and nsec is set to 0. If the
# hour and minute is passed, then sec, usec and nsec is set to 0. The +options+ # hour and minute is passed, then sec, usec, and nsec is set to 0. The +options+
# parameter takes a hash with any of these keys: <tt>:year</tt>, <tt>:month</tt>, # parameter takes a hash with any of these keys: <tt>:year</tt>, <tt>:month</tt>,
# <tt>:day</tt>, <tt>:hour</tt>, <tt>:min</tt>, <tt>:sec</tt>, <tt>:usec</tt>, # <tt>:day</tt>, <tt>:hour</tt>, <tt>:min</tt>, <tt>:sec</tt>, <tt>:usec</tt>,
# <tt>:nsec</tt>, <tt>:offset</tt>, <tt>:zone</tt>. Pass either <tt>:usec</tt> # <tt>:nsec</tt>, <tt>:offset</tt>, <tt>:zone</tt>. Pass either <tt>:usec</tt>

View File

@ -13,7 +13,7 @@ module ActiveSupport
# (e.g., "Eastern Time (US & Canada)" instead of "America/New_York"). # (e.g., "Eastern Time (US & Canada)" instead of "America/New_York").
# * Lazily load TZInfo::Timezone instances only when they're needed. # * Lazily load TZInfo::Timezone instances only when they're needed.
# * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+, # * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+,
# +parse+, +at+ and +now+ methods. # +parse+, +at+, and +now+ methods.
# #
# If you set <tt>config.time_zone</tt> in the Rails Application, you can # If you set <tt>config.time_zone</tt> in the Rails Application, you can
# access this TimeZone object via <tt>Time.zone</tt>: # access this TimeZone object via <tt>Time.zone</tt>:

View File

@ -49,7 +49,7 @@ module Minitest
end end
# Owes great inspiration to test runner trailblazers like RSpec, # Owes great inspiration to test runner trailblazers like RSpec,
# minitest-reporters, maxitest and others. # minitest-reporters, maxitest, and others.
def self.plugin_rails_init(options) def self.plugin_rails_init(options)
unless options[:full_backtrace] || ENV["BACKTRACE"] unless options[:full_backtrace] || ENV["BACKTRACE"]
# Plugin can run without Rails loaded, check before filtering. # Plugin can run without Rails loaded, check before filtering.

View File

@ -27,7 +27,7 @@ module Rails
# Besides providing the same configuration as Rails::Engine and Rails::Railtie, # Besides providing the same configuration as Rails::Engine and Rails::Railtie,
# the application object has several specific configurations, for example # the application object has several specific configurations, for example
# "cache_classes", "consider_all_requests_local", "filter_parameters", # "cache_classes", "consider_all_requests_local", "filter_parameters",
# "logger" and so forth. # "logger", and so forth.
# #
# Check Rails::Application::Configuration to see them all. # Check Rails::Application::Configuration to see them all.
# #
@ -52,9 +52,9 @@ module Rails
# 4) Run config.before_configuration callbacks # 4) Run config.before_configuration callbacks
# 5) Load config/environments/ENV.rb # 5) Load config/environments/ENV.rb
# 6) Run config.before_initialize callbacks # 6) Run config.before_initialize callbacks
# 7) Run Railtie#initializer defined by railties, engines and application. # 7) Run Railtie#initializer defined by railties, engines, and application.
# One by one, each engine sets up its load paths and routes, and runs its config/initializers/* files. # One by one, each engine sets up its load paths and routes, and runs its config/initializers/* files.
# 8) Custom Railtie#initializers added by railties, engines and applications are executed # 8) Custom Railtie#initializers added by railties, engines, and applications are executed
# 9) Build the middleware stack and run to_prepare callbacks # 9) Build the middleware stack and run to_prepare callbacks
# 10) Run config.before_eager_load and eager_load! if eager_load is true # 10) Run config.before_eager_load and eager_load! if eager_load is true
# 11) Run config.after_initialize callbacks # 11) Run config.after_initialize callbacks

View File

@ -26,7 +26,7 @@ module Rails
ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence || "development" ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence || "development"
end end
# Receives a namespace, arguments and the behavior to invoke the command. # Receives a namespace, arguments, and the behavior to invoke the command.
def invoke(full_namespace, args = [], **config) def invoke(full_namespace, args = [], **config)
namespace = full_namespace = full_namespace.to_s namespace = full_namespace = full_namespace.to_s

View File

@ -31,7 +31,7 @@ module Rails
# end # end
# #
# Then ensure that this file is loaded at the top of your <tt>config/application.rb</tt> # Then ensure that this file is loaded at the top of your <tt>config/application.rb</tt>
# (or in your +Gemfile+), and it will automatically load models, controllers and helpers # (or in your +Gemfile+), and it will automatically load models, controllers, and helpers
# inside +app+, load routes at <tt>config/routes.rb</tt>, load locales at # inside +app+, load routes at <tt>config/routes.rb</tt>, load locales at
# <tt>config/locales/**/*</tt>, and load tasks at <tt>lib/tasks/**/*</tt>. # <tt>config/locales/**/*</tt>, and load tasks at <tt>lib/tasks/**/*</tt>.
# #
@ -192,13 +192,13 @@ module Rails
# #
# == Isolated Engine # == Isolated Engine
# #
# Normally when you create controllers, helpers and models inside an engine, they are treated # Normally when you create controllers, helpers, and models inside an engine, they are treated
# as if they were created inside the application itself. This means that all helpers and # as if they were created inside the application itself. This means that all helpers and
# named routes from the application will be available to your engine's controllers as well. # named routes from the application will be available to your engine's controllers as well.
# #
# However, sometimes you want to isolate your engine from the application, especially if your engine # However, sometimes you want to isolate your engine from the application, especially if your engine
# has its own router. To do that, you simply need to call +isolate_namespace+. This method requires # has its own router. To do that, you simply need to call +isolate_namespace+. This method requires
# you to pass a module where all your controllers, helpers and models should be nested to: # you to pass a module where all your controllers, helpers, and models should be nested to:
# #
# module MyEngine # module MyEngine
# class Engine < Rails::Engine # class Engine < Rails::Engine

View File

@ -253,8 +253,8 @@ module Rails
invoke_fallbacks_for(name, base) || invoke_fallbacks_for(context, name) invoke_fallbacks_for(name, base) || invoke_fallbacks_for(context, name)
end end
# Receives a namespace, arguments and the behavior to invoke the generator. # Receives a namespace, arguments, and the behavior to invoke the generator.
# It's used as the default entry point for generate, destroy and update # It's used as the default entry point for generate, destroy, and update
# commands. # commands.
def invoke(namespace, args = ARGV, config = {}) def invoke(namespace, args = ARGV, config = {})
names = namespace.to_s.split(":") names = namespace.to_s.split(":")