Skip to content

Commit

Permalink
Fix typos (#5938)
Browse files Browse the repository at this point in the history
* Fix typos in code comments

* Fix typos in changelog

* Fix typos in test descriptions

* Fix typo in a test helper method name
  • Loading branch information
beyondcompute authored Jan 17, 2025
1 parent 8d3c92f commit 55beb7d
Show file tree
Hide file tree
Showing 46 changed files with 78 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ functions:
git submodule update --init --recursive
"create expansions":
# Make an evergreen exapanstion file with dynamic values
# Make an evergreen expansion file with dynamic values
- command: shell.exec
params:
working_dir: "src"
Expand Down
16 changes: 8 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ For instructions on upgrading to newer versions, visit

* \#4005 Fixed inclusion of mongoid with Rails components that don't have the Rails environment.

* \#3993 Fixes issue where `dup`/`clone` fails for embedded documents that use store_as without using Mongoid::Atributes::Dynamic
* \#3993 Fixes issue where `dup`/`clone` fails for embedded documents that use store_as without using Mongoid::Attributes::Dynamic

* \#3991 Fixed embedded documents not flagging as changed after calling #changed? and modifying the
child elements.
Expand Down Expand Up @@ -798,7 +798,7 @@ child elements.
Band.where(name: "Placebo").unset(:members, :origin)

* \#2669 Passing a block to `Criteria#new` now properly sends the
block through to the model's contructor. (Arthur Neves)
block through to the model's constructor. (Arthur Neves)

* \#2667 `exists?` no longer hits the database in cases where we have
the necessary information in memory.
Expand Down Expand Up @@ -1200,7 +1200,7 @@ child elements.

* \#2571 Remove blank error message from locales. (Jordan Elver)

* \#2568 Fix uniqueness validation for lacalized fields when a scope is also
* \#2568 Fix uniqueness validation for localized fields when a scope is also
provided.

* \#2552 Ensure `InvalidPath` errors are raised when embedded documents try to
Expand Down Expand Up @@ -1609,7 +1609,7 @@ child elements.

Band.first.touch

Update a specific time field along with the udpated_at.
Update a specific time field along with the updated_at.

Band.first.touch(:founded)

Expand Down Expand Up @@ -1728,7 +1728,7 @@ child elements.
# { "name" => "foo", "my_preferences" => [{ "value" => "ok" }]}

* \#1806 `Model.find_or_create_by` and `Model.find_or_initialize_by` can now
take documents as paramters for belongs_to relations.
take documents as parameters for belongs_to relations.

person = Person.first
Game.find_or_create_by(person: person)
Expand Down Expand Up @@ -2506,7 +2506,7 @@ child elements.
* \#2038 Allow inverse relations to be determined by foreign keys alone
if defined on both sides, not just an inverse_of declaration.

* \#2023 Allow serilialization of dynamic types that conflict with core
* \#2023 Allow serialization of dynamic types that conflict with core
Ruby methods to still be serialized.

* \#2008 Presence validation should hit the db to check validity if the
Expand Down Expand Up @@ -2611,7 +2611,7 @@ child elements.
had the foreign key link persisted.

* \#1820 Destroying embedded documents in an embeds_many should also
removed the document from the underlying _uncoped target and reindex
removed the document from the underlying _unscoped target and reindex
the relation.

* \#1814 Don't cascade callbacks on after_initialize.
Expand Down Expand Up @@ -3059,7 +3059,7 @@ child elements.
key without error.

* \#1350, \#1351 Fixed errors in the string conversions of double quotes and
tilde when paramterizing keys.
tilde when parametrizing keys.

* \#1349 Mongoid documents should not blow up when including Enumerable.
(Jonas Nicklas)
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/association/embedded/embeds_many/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ def integrate(document)
#
# @return [ Criteria | Object ] A Criteria or return value from the target.
#
# TODO: make sure we are consistingly using respond_to_missing
# TODO: make sure we are consistently using respond_to_missing
# anywhere we define method_missing.
# rubocop:disable Style/MissingRespondToMissing
ruby2_keywords def method_missing(name, *args, &block)
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/association/referenced/has_many/enumerable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def first(limit = nil)
# Initialize the new enumerable either with a criteria or an array.
#
# @example Initialize the enumerable with a criteria.
# Enumberable.new(Post.where(:person_id => id))
# Enumerable.new(Post.where(:person_id => id))
#
# @example Initialize the enumerable with an array.
# Enumerable.new([ post ])
Expand Down
6 changes: 3 additions & 3 deletions lib/mongoid/association/referenced/has_many/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def delete(document)
# @example Delete all documents in the association.
# person.posts.delete_all
#
# @example Conditonally delete all documents in the association.
# @example Conditionally delete all documents in the association.
# person.posts.delete_all({ :title => "Testing" })
#
# @param [ Hash ] conditions Optional conditions to delete with.
Expand Down Expand Up @@ -462,7 +462,7 @@ def cascade!(document)
#
# @return [ Criteria | Object ] A Criteria or return value from the target.
#
# TODO: make sure we are consistingly using respond_to_missing
# TODO: make sure we are consistently using respond_to_missing
# anywhere we define method_missing.
# rubocop:disable Style/MissingRespondToMissing
ruby2_keywords def method_missing(name, *args, &block)
Expand Down Expand Up @@ -512,7 +512,7 @@ def persistable?
# @example Delete all documents in the association.
# person.posts.delete_all
#
# @example Conditonally delete all documents in the association.
# @example Conditionally delete all documents in the association.
# person.posts.delete_all({ :title => "Testing" })
#
# @param [ Hash ] conditions Optional conditions to delete with.
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/atomic/modifiers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def add_operation(mods, field, value)
end

# Adds or appends an array operation with the $each specifier used
# in conjuction with $push.
# in conjunction with $push.
#
# @example Add the operation.
# modifications.add_operation(mods, field, value)
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def read_attribute_before_type_cast(name)
# @param [ String | Symbol ] name The name of the attribute to remove.
#
# @raise [ Errors::ReadonlyAttribute ] If the field cannot be removed due
# to being flagged as reaodnly.
# to being flagged as readonly.
def remove_attribute(name)
validate_writable_field_name!(name.to_s)
as_writable_attribute!(name) do |access|
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ module Config
#
# Setting this flag to true restores the pre-9.0 behavior, where callbacks
# for embedded documents are called. This may lead to stack overflow errors
# if there are more than cicrca 1000 embedded documents in the root
# if there are more than circa 1000 embedded documents in the root
# document's dependencies graph.
# See https://jira.mongodb.org/browse/MONGOID-5658 for more details.
option :around_callbacks_for_embeds, default: false
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/contextual/aggregable/memory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def min(field = nil)
# @example Get the sum for the provided block.
# aggregable.sum(&:likes)
#
# @param [ Symbol | Numeric ] field The field to sum, or the intial
# @param [ Symbol | Numeric ] field The field to sum, or the initial
# value of the sum when a block is given.
#
# @return [ Numeric ] The sum value.
Expand Down
4 changes: 2 additions & 2 deletions lib/mongoid/contextual/mongo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def count(options = {}, &block)
# Get the estimated number of documents matching the query.
#
# Unlike count, estimated_count does not take a block because it is not
# traditionally defined (with a block) on Enumarable like count is.
# traditionally defined (with a block) on Enumerable like count is.
#
# @example Get the estimated number of matching documents.
# context.estimated_count
Expand Down Expand Up @@ -1018,7 +1018,7 @@ def demongoize_hash(klass, hash)
next
end

# does the key represent an emebedded relation on the document?
# does the key represent an embedded relation on the document?
aliased_name = klass.aliased_associations[key] || key
if (assoc = klass.relations[aliased_name])
case value
Expand Down
14 changes: 7 additions & 7 deletions lib/mongoid/criteria.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def ==(other)
# and finds one or many documents for the provided _id values.
#
# If this method is given a block, it delegates to +Enumerable#find+ and
# returns the first document of those found by the current Crieria object
# returns the first document of those found by the current Criteria object
# for which the block returns a truthy value.
#
# Note that the "default proc" argument of Enumerable is not specially
Expand All @@ -99,7 +99,7 @@ def ==(other)
# a nested array. Each array will be flattened.
#
# @example Finds a document by its _id, invokes Findable#find.
# critera.find("1234")
# criteria.find("1234")
#
# @example Finds the first matching document using a block, invokes Enumerable#find.
# criteria.find { |item| item.name == "Depeche Mode" }
Expand Down Expand Up @@ -364,7 +364,7 @@ def empty_and_chainable?
!!@none
end

# Overriden to include _type in the fields.
# Overridden to include _type in the fields.
#
# @example Limit the fields returned from the database.
# Band.only(:name)
Expand Down Expand Up @@ -398,7 +398,7 @@ def read(value = nil)
end
end

# Overriden to exclude _id from the fields.
# Overridden to exclude _id from the fields.
#
# @example Exclude fields returned from the database.
# Band.without(:name)
Expand All @@ -414,7 +414,7 @@ def without(*args)
# Returns true if criteria responds to the given method.
#
# @example Does the criteria respond to the method?
# crtiteria.respond_to?(:each)
# criteria.respond_to?(:each)
#
# @param [ Symbol ] name The name of the class method on the +Document+.
# @param [ true | false ] include_private Whether to include privates.
Expand Down Expand Up @@ -483,8 +483,8 @@ def where(*args)
# Historically this method required exactly one argument.
# As of https://jira.mongodb.org/browse/MONGOID-4804 it also accepts
# zero arguments.
# The underlying where implemetation that super invokes supports
# any number of arguments, but we don't presently allow mutiple
# The underlying where implementation that super invokes supports
# any number of arguments, but we don't presently allow multiple
# arguments through this method. This API can be reconsidered in the
# future.
if args.length > 1
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/criteria/queryable/expandable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module Expandable
#
# The following parameter forms are accepted:
#
# - field is a string or symbol; value is the field query expresision
# - field is a string or symbol; value is the field query expression
# - field is a Key instance; value is the field query expression
# - field is a string corresponding to a MongoDB operator; value is
# the operator value expression.
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/criteria/scopable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def remove_scoping(other)
self
end

# Forces the criteria to be scoped, unless its inside an unscoped block.
# Forces the criteria to be scoped, unless it's inside an unscoped block.
#
# @example Force the criteria to be scoped.
# criteria.scoped(skip: 10)
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/errors/unregistered_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Errors
# class in a polymorphic association, but the class has not previously
# been registered by resolver that was used for the query.
#
# Here's an exammple:
# Here's an example:
#
# class Department
# include Mongoid::Document
Expand Down
4 changes: 2 additions & 2 deletions lib/mongoid/factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Mongoid
module Factory
extend self

# A helper class for instantiating a model using either it's type
# A helper class for instantiating a model using either its type
# class directly, or via a type class specified via a discriminator
# key.
#
Expand Down Expand Up @@ -99,7 +99,7 @@ def instantiate_with_type(execute_callbacks)
)
end

# Retreive the `Class` instance of the requested type, either by finding it
# Retrieve the `Class` instance of the requested type, either by finding it
# in the `klass` discriminator mapping, or by otherwise finding a
# Document model with the given name.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def options
# @param [ String ] key The key used to search the association tree.
# @param [ Hash ] fields The fields to begin the search with.
# @param [ Hash ] associations The associations to begin the search with.
# @param [ Hash ] aliased_associations The alaised associations to begin
# @param [ Hash ] aliased_associations The aliased associations to begin
# the search with.
# @param &block The block.
# @yieldparam [ Symbol ] The current method.
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/findable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def exists?(id_or_conditions = :none)
# during query construction.
#
# If this method is given a block, it delegates to +Enumerable#find+ and
# returns the first document of those found by the current Crieria object
# returns the first document of those found by the current Criteria object
# for which the block returns a truthy value. If both a block and ids are
# given, the block is ignored and the documents for the given ids are
# returned. If a block and a Proc are given, the method delegates to
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module Matcher
# @return [ Object | Array ] Field value or values.
module_function def extract_attribute(document, key)
# The matcher system will wind up sending atomic values to this as well,
# when attepting to match more complex types. If anything other than a
# when attempting to match more complex types. If anything other than a
# Document or a Hash is given, we'll short-circuit the logic and just
# return an empty array.
return [] unless document.is_a?(Hash) || document.is_a?(Document)
Expand Down
4 changes: 2 additions & 2 deletions lib/mongoid/persistence_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def context_store
# Get the persistence context for a given object from the thread local
# storage.
#
# @param [ Object ] object Object to get the persistance context for.
# @param [ Object ] object Object to get the persistence context for.
#
# @return [ Mongoid::PersistenceContext | nil ] The persistence context
# for the object if previously stored, otherwise nil.
Expand All @@ -305,7 +305,7 @@ def get_context(object)
# Store persistence context for a given object in the thread local
# storage.
#
# @param [ Object ] object Object to store the persistance context for.
# @param [ Object ] object Object to store the persistence context for.
# @param [ Mongoid::PersistenceContext ] context Context to store
#
# @api private
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def self.rescue_responses
end

# Rails runs all initializers first before getting into any generator
# code, so we have no way in the intitializer to know if we are
# code, so we have no way in the initializer to know if we are
# generating a mongoid.yml. So instead of failing, we catch all the
# errors and print them out.
def handle_configuration_error(e)
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/stateful.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def flagged_for_destroy?
alias :marked_for_destruction? :flagged_for_destroy?
alias :_destroy :flagged_for_destroy?

# Returns true if the +Document+ has been succesfully destroyed, and false
# Returns true if the +Document+ has been successfully destroyed, and false
# if it hasn't. This is determined by the variable @destroyed and NOT
# by checking the database.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/mongoid/threaded.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module Threaded
# given, and the variable does not already exist, the return value of the
# block will be set as the value of the variable before returning it.
#
# It is very important that applications (and espcially Mongoid)
# It is very important that applications (and especially Mongoid)
# use this method instead of Thread#[], since Thread#[] is actually for
# fiber-local variables, and Mongoid uses Fibers as an implementation
# detail in some callbacks. Putting thread-local state in a fiber-local
Expand Down
4 changes: 2 additions & 2 deletions lib/rails/generators/mongoid/config/templates/mongoid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ development:
driver_options:
# When this flag is off, an aggregation done on a view will be executed over
# the documents included in that view, instead of all documents in the
# collection. When this flag is on, the view fiter is ignored.
# collection. When this flag is on, the view filter is ignored.
# broken_view_aggregate: true

# When this flag is set to false, the view options will be correctly
# propagated to readable methods.
# broken_view_options: true

# When this flag is set to true, the update and replace methods will
# validate the paramters and raise an error if they are invalid.
# validate the parameters and raise an error if they are invalid.
# validate_update_replace: false


Expand Down
2 changes: 1 addition & 1 deletion perf/benchmark_ips.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def preferences
end

# IMPROVEME:
# the same problem here as was metioned above.
# the same problem here as was mentioned above.
bm.report("#find") do
person.posts.find(person_post_id)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/associations/belongs_to_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def quarantine(context, polymorphic:, dept_aliases:, team_aliases:)
# Have to eval this, because otherwise we get syntax errors when defining a class
# inside a method.
#
# I know the scissors are sharp! But I want to run with them anwyay!
# I know the scissors are sharp! But I want to run with them anyway!
Object.class_eval <<-RUBY
class SandboxManager; include Mongoid::Document; end
class SandboxDepartment; include Mongoid::Document; end
Expand Down
Loading

0 comments on commit 55beb7d

Please sign in to comment.