source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/boolean_spec.rb
Ruby
mit
3,920
master
4,471
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Boolean do describe '.evolve' do context 'when provided a boolean' do context 'when provided true' do it 'returns true' do expect(described_class.evolve(true)).to eq(true) end end context 'when pro...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/range_spec.rb
Ruby
mit
3,920
master
11,141
# frozen_string_literal: true require 'spec_helper' describe Range do describe '#__array__' do it 'returns the range as an array' do expect((1..3).__array__).to eq([ 1, 2, 3 ]) end end describe '#__evolve_date__' do subject(:evolved) { (min..max).__evolve_date__ } context 'when the range...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/date_spec.rb
Ruby
mit
3,920
master
6,878
# frozen_string_literal: true require 'spec_helper' describe Date do describe '#__evolve_date__' do let(:date) do Date.new(2010, 1, 1) end let(:evolved) do date.__evolve_date__ end let(:expected) do Time.utc(2010, 1, 1, 0, 0, 0) end it 'returns the time' do exp...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/integer_spec.rb
Ruby
mit
3,920
master
2,912
# frozen_string_literal: true require 'spec_helper' describe Integer do describe '.evolve' do context 'when provided a string' do context 'when the string is a number' do context 'when the string is an integer' do it 'returns an integer' do expect(described_class.evolve('1'))...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/array_spec.rb
Ruby
mit
3,920
master
10,931
# frozen_string_literal: true require 'spec_helper' describe Array do describe '.evolve' do context 'when provided an Array' do let(:array) do [ 1, 2, 3 ] end it 'returns an array' do expect(described_class.evolve(array)).to eq([ 1, 2, 3 ]) end it "doesn't mutate ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/big_decimal_spec.rb
Ruby
mit
3,920
master
5,705
# frozen_string_literal: true require 'spec_helper' describe BigDecimal do describe '.evolve' do context 'when map_big_decimal_to_decimal128 is false' do config_override :map_big_decimal_to_decimal128, false context 'when provided a big decimal' do let(:big_decimal) do BigDecimal(...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/string_spec.rb
Ruby
mit
3,920
master
6,242
# frozen_string_literal: true require 'spec_helper' describe String do describe '#__evolve_date__' do context 'when the string is verbose' do let(:date) do '1st Jan 2010' end let(:evolved) do date.__evolve_date__ end it 'returns the strings as a times' do ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/object_spec.rb
Ruby
mit
3,920
master
2,374
# frozen_string_literal: true require 'spec_helper' describe Object do describe '#__add__' do context 'when the other object is a non-enumerable' do context 'when the values are unique' do it 'returns an array of both' do expect(5.__add__(6)).to eq([ 5, 6 ]) end end ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/numeric_spec.rb
Ruby
mit
3,920
master
2,901
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Criteria::Queryable::Extensions::Numeric::ClassMethods do let(:host) do Class.new do include Mongoid::Criteria::Queryable::Extensions::Numeric::ClassMethods end.new end describe '#__numeric__' do let(:actual) { host.__numer...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/regexp_spec.rb
Ruby
mit
3,920
master
1,422
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Criteria::Queryable::Extensions::Regexp do describe '.evolve' do context 'when provided a regexp' do let(:regexp) do /\A[123]/ end let(:evolved) do Regexp.evolve(regexp) end it 'returns the rege...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/time_with_zone_spec.rb
Ruby
mit
3,920
master
7,961
# frozen_string_literal: true require 'spec_helper' describe ActiveSupport::TimeWithZone do let(:time_zone) do ActiveSupport::TimeZone.new('Eastern Time (US & Canada)') end describe '.evolve' do context 'when provided a time' do let(:date) do time_zone.local(2010, 1, 1, 12, 0, 0) en...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/hash_spec.rb
Ruby
mit
3,920
master
6,973
# frozen_string_literal: true require 'spec_helper' describe Hash do describe '#__add__' do context 'when the other object is a hash' do context 'when a key matches' do context 'when the existing value is a non-enumerable' do context 'when the added value is non-enumerable' do ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/criteria/queryable/extensions/nil_class_spec.rb
Ruby
mit
3,920
master
1,459
# frozen_string_literal: true require 'spec_helper' describe NilClass do describe '#__add__' do it 'returns the object' do expect(nil.__add__(1)).to eq(1) end end describe '#__evolve_date__' do it 'returns nil' do expect(nil.__evolve_date__).to be_nil end end describe '#__evolv...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/attributes/readonly_spec.rb
Ruby
mit
3,920
master
7,541
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Attributes::Readonly do before do Person.attr_readonly(*attributes) end after do Person.readonly_attributes.reject! do |a| [ attributes ].flatten.include?(a.to_sym) || [ attributes ].flatten.include?(Person.aliased_fiel...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/attributes/dynamic_spec.rb
Ruby
mit
3,920
master
3,687
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Attributes::Dynamic do shared_examples_for 'dynamic field' do let(:raw_attributes) do { attr_name => 'foo bar' } end context 'when reading attributes' do context 'an unsaved model' do it 'can be read' do ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/attributes/projector_spec.rb
Ruby
mit
3,920
master
1,054
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Attributes::Projector do Dir[File.join(File.dirname(__FILE__), 'projector_data', '*.yml')].sort.each do |path| context File.basename(path) do specs = YAML.safe_load(File.read(path), aliases: true) specs.each do |spec| con...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/attributes/nested_spec.rb
Ruby
mit
3,920
master
152,605
# frozen_string_literal: true require 'spec_helper' require 'support/models/sandwich' require_relative '../association/referenced/has_many_models' require_relative '../association/referenced/has_and_belongs_to_many_models' require_relative 'nested_spec_models' describe Mongoid::Attributes::Nested do describe '.acce...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/attributes/embedded_spec.rb
Ruby
mit
3,920
master
3,207
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Attributes::Embedded do describe '.traverse' do subject(:embedded) { described_class.traverse(attributes, path) } let(:path) { '100.name' } context 'when the attribute key is a string' do let(:attributes) { { '100' => { 'name'...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/attributes/nested_spec_models.rb
Ruby
mit
3,920
master
987
# frozen_string_literal: true class NestedAuthor include Mongoid::Document field :name, type: String has_one :post, class_name: 'NestedPost' accepts_nested_attributes_for :post end class NestedComment include Mongoid::Document field :body, type: String belongs_to :post, class_name: 'NestedPost' end c...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/timestamps/updated_spec.rb
Ruby
mit
3,920
master
1,680
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Timestamps::Updated do describe '.included' do let(:agent) do Agent.new end let(:fields) do Agent.fields end before do agent.run_callbacks(:create) agent.run_callbacks(:save) end it 'does not...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/timestamps/timeless_spec.rb
Ruby
mit
3,920
master
3,340
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Timestamps::Timeless do describe '#timeless' do before(:all) do class Chicken include Mongoid::Document include Mongoid::Timestamps before_save :lay_timeless_egg def lay_timeless_egg Egg.timel...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/timestamps/created_spec.rb
Ruby
mit
3,920
master
1,321
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Timestamps::Created do describe '.included' do let(:quiz) do Quiz.new end let(:fields) do Quiz.fields end before do quiz.run_callbacks(:create) quiz.run_callbacks(:save) end it 'adds created_...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/timestamps/updated/short_spec.rb
Ruby
mit
3,920
master
1,876
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Timestamps::Updated::Short do describe '.included' do let(:agent) do ShortAgent.new end let(:fields) do ShortAgent.fields end before do agent.run_callbacks(:create) agent.run_callbacks(:save) end ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/timestamps/created/short_spec.rb
Ruby
mit
3,920
master
1,051
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Timestamps::Created::Short do describe '.included' do let(:quiz) do ShortQuiz.new end let(:fields) do ShortQuiz.fields end before do quiz.run_callbacks(:create) quiz.run_callbacks(:save) end ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/atomic/modifiers_spec.rb
Ruby
mit
3,920
master
12,771
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Atomic::Modifiers do let(:modifiers) do described_class.new end describe '#push_conflict?' do let(:result) { modifiers.send(:push_conflict?, field) } context 'for embeds many subdocument' do context 'when another field on ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/atomic/paths_spec.rb
Ruby
mit
3,920
master
8,021
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Atomic::Paths do let(:person) do Person.new end let(:address) do Address.new(street: 'testing') end let(:location) do Location.new end let(:name) do Name.new end describe '#atomic_delete_modifier' do before...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/atomic/paths/root_spec.rb
Ruby
mit
3,920
master
830
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Atomic::Paths::Root do let(:person) do Person.new end let(:root) do described_class.new(person) end describe '#document' do it 'returns the document' do expect(root.document).to eq(person) end end describe '#p...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/atomic/paths/embedded/many_spec.rb
Ruby
mit
3,920
master
2,351
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Atomic::Paths::Embedded::Many do let(:person) do Person.new end let(:many) do described_class.new(address) end let(:address) do Address.new(street: 'Strassmannstr.') end let(:phone) do Phone.new(number: '+33123456789...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/atomic/paths/embedded/one_spec.rb
Ruby
mit
3,920
master
2,127
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Atomic::Paths::Embedded::One do let(:person) do Person.new end let(:one) do described_class.new(name) end let(:name) do Name.new(first_name: 'Syd') end before do person.name = name end describe '#delete_modifier...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/tasks/encryption_spec.rb
Ruby
mit
3,920
master
5,920
# frozen_string_literal: true require 'spec_helper' describe 'Mongoid::Tasks::Encryption' do require_enterprise require_libmongocrypt include_context 'with encryption' restore_config_clients describe '.create_data_key' do let(:config) do { default: { hosts: SpecConfig.instance.addresses, ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/tasks/database_rake_spec.rb
Ruby
mit
3,920
master
9,718
# frozen_string_literal: true require 'rake' require 'spec_helper' require 'support/feature_sandbox' shared_context 'rake task' do min_server_version '4.4' let(:task_name) { self.class.top_level_description } let(:task) { Rake.application[task_name] } let(:task_file) { 'mongoid/tasks/database' } let(:logge...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/tasks/database_spec.rb
Ruby
mit
3,920
master
9,029
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Tasks::Database do before(:all) do module DatabaseSpec class Measurement include Mongoid::Document field :timestamp, type: Time field :temperature, type: Integer embeds_many :comments store_in ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
examples/mongoid_test.rb
Ruby
mit
3,920
master
849
# frozen_string_literal: true require 'mongoid' require 'mongoid/support/query_counter' require 'minitest/autorun' # Ensure backward compatibility with Minitest 4 Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) Mongoid.configure.connect_to('mongoid_test') def count_queries(&block) query_c...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid.rb
Ruby
mit
3,920
master
4,474
# frozen_string_literal: true require 'forwardable' require 'time' require 'set' require 'active_support' require 'active_support/core_ext' require 'active_support/json' require 'active_support/inflector' require 'active_support/time_with_zone' require 'active_model' require 'concurrent-ruby' require 'mongo' requir...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/rails/mongoid.rb
Ruby
mit
3,920
master
822
# frozen_string_literal: true module Rails # Mongoid utilities for Rails module Mongoid extend self # Use the application configuration to get every model and require it, so # that indexing and inheritance work in both development and production # with the same results. # # @example Load a...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/rails/generators/mongoid_generator.rb
Ruby
mit
3,920
master
1,002
# frozen_string_literal: true require 'rails/generators/named_base' require 'rails/generators/active_model' module Mongoid module Generators # Base generator class for adding Mongoid to Rails applications. class Base < ::Rails::Generators::NamedBase # Returns the path to the templates directory. ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/rails/generators/mongoid/config/config_generator.rb
Ruby
mit
3,920
master
1,290
# frozen_string_literal: true require 'rails/generators/mongoid_generator' module Mongoid module Generators # Generator class for Mongoid configuration files. class ConfigGenerator < Rails::Generators::Base desc 'Creates Mongoid configuration files' argument :database_name, type: :string, optio...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/rails/generators/mongoid/config/templates/mongoid.rb
Ruby
mit
3,920
master
817
Mongoid.configure do target_version = "<%= Mongoid::VERSION[/^\d+.\d+/] %>" # Load Mongoid behavior defaults. This automatically sets # features flags (refer to documentation) config.load_defaults target_version # It is recommended to use config/mongoid.yml for most Mongoid-related # configuration, whenev...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/rails/generators/mongoid/model/model_generator.rb
Ruby
mit
3,920
master
825
# frozen_string_literal: true require 'rails/generators/mongoid_generator' module Mongoid module Generators # Generator class for Mongoid model files. class ModelGenerator < Base desc 'Creates a Mongoid model' argument :attributes, type: :array, default: [], banner: 'field:type field:type' ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/threaded.rb
Ruby
mit
3,920
master
18,004
# frozen_string_literal: true require 'mongoid/threaded/lifecycle' module Mongoid # This module contains logic for easy access to objects that have a lifecycle # on the current thread. module Threaded # The key for the shared thread- and fiber-local storage. It must be a # symbol because keys for fiber-...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/encryptable.rb
Ruby
mit
3,920
master
1,944
module Mongoid # This module is used to extend Mongoid::Document # to add encryption functionality. module Encryptable extend ActiveSupport::Concern included do # @return [Hash] The encryption metadata for the model. class_attribute :encrypt_metadata self.encrypt_metadata = {} end ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/shardable.rb
Ruby
mit
3,920
master
4,956
# frozen_string_literal: true module Mongoid # This module contains behavior for adding shard key fields to updates. module Shardable extend ActiveSupport::Concern included do # Returns the list of shard key fields, if shard key was declared on # this model. If no shard key was declared, retur...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/composable.rb
Ruby
mit
3,920
master
3,709
# frozen_string_literal: true require 'mongoid/changeable' require 'mongoid/collection_configurable' require 'mongoid/encryptable' require 'mongoid/findable' require 'mongoid/identifiable' require 'mongoid/indexable' require 'mongoid/inspectable' require 'mongoid/interceptable' require 'mongoid/matcher' require 'mongo...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/validatable.rb
Ruby
mit
3,920
master
5,142
# frozen_string_literal: true require 'mongoid/validatable/macros' require 'mongoid/validatable/localizable' require 'mongoid/validatable/associated' require 'mongoid/validatable/format' require 'mongoid/validatable/length' require 'mongoid/validatable/numericality' require 'mongoid/validatable/queryable' require 'mon...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/equality.rb
Ruby
mit
3,920
master
1,879
# frozen_string_literal: true module Mongoid # This module contains the behavior of Mongoid's clone/dup of documents. module Equality # Leave the current contents of this module outside of InstanceMethods # to prevent cherry picking conflicts. For now... extend ActiveSupport::Concern # Default com...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/atomic_update_preparer.rb
Ruby
mit
3,920
master
3,080
# frozen_string_literal: true module Mongoid # A singleton class to assist with preparing attributes for atomic # updates. # # Once the deprecated Hash#__consolidate__ method is removed entirely, # these methods may be moved into Mongoid::Contextual::Mongo as private # methods. # # @api private class...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/cacheable.rb
Ruby
mit
3,920
master
1,790
# frozen_string_literal: true module Mongoid # Encapsulates behavior around caching. module Cacheable extend ActiveSupport::Concern included do cattr_accessor :cache_timestamp_format, instance_writer: false self.cache_timestamp_format = :nsec end # Print out the cache key. This will a...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/config.rb
Ruby
mit
3,920
master
20,934
# frozen_string_literal: true require 'mongoid/config/defaults' require 'mongoid/config/environment' require 'mongoid/config/options' require 'mongoid/config/validators' require 'mongoid/config/introspection' require 'mongoid/config/encryption' module Mongoid # This module defines all the configuration options for ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/model_resolver.rb
Ruby
mit
3,920
master
6,129
# frozen_string_literal: true require 'forwardable' module Mongoid # The default class for resolving model classes based on discriminant keys. # Given a key, it will return the corresponding model class, if any. By # default, it looks for classes with names that match the given keys, but # additional mappings...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/positional.rb
Ruby
mit
3,920
master
2,494
# frozen_string_literal: true module Mongoid # This module is responsible for taking update selectors and switching out # the indexes for the $ positional operator where appropriate. module Positional # Takes the provided selector and atomic operations and replaces the # indexes of the embedded documents...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/touchable.rb
Ruby
mit
3,920
master
8,316
# frozen_string_literal: true module Mongoid # Mixin module which is included in Mongoid::Document to add "touch" # functionality to update a document's timestamp(s) atomically. module Touchable # Used to provide mixin functionality. # # @todo Refactor using ActiveSupport::Concern module Instance...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/selectable.rb
Ruby
mit
3,920
master
1,362
# frozen_string_literal: true module Mongoid # Provides behavior for generating the selector for a specific document. module Selectable extend ActiveSupport::Concern # Get the atomic selector for the document. This is a hash in the simplest # case { "_id" => id }, but can become more complex for embed...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/loadable.rb
Ruby
mit
3,920
master
5,369
# frozen_string_literal: true module Mongoid # Defines how Mongoid can autoload all defined models. module Loadable # The default list of paths where model classes should be looked for. If # Rails is present, the "app/models" paths will be used instead. # (See #model_paths.) DEFAULT_MODEL_PATHS = %...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/stateful.rb
Ruby
mit
3,920
master
4,563
# frozen_string_literal: true module Mongoid # Mixin module included into Mongoid::Document which adds behavior for # getting the various lifecycle states a document can transition through. module Stateful attr_writer :destroyed, :flagged_for_destroy, :previously_new_record # Sets whether the document h...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/timestamps.rb
Ruby
mit
3,920
master
401
# frozen_string_literal: true require 'mongoid/timestamps/timeless' require 'mongoid/timestamps/created' require 'mongoid/timestamps/updated' require 'mongoid/timestamps/short' module Mongoid # This module handles the behavior for setting up document created at and # updated at timestamps. module Timestamps ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/traversable.rb
Ruby
mit
3,920
master
13,845
# frozen_string_literal: true require 'mongoid/fields/validators/macro' require 'mongoid/model_resolver' module Mongoid # Mixin module included in Mongoid::Document to provide behavior # around traversing the document graph. module Traversable extend ActiveSupport::Concern # This code is extracted from...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/pluckable.rb
Ruby
mit
3,920
master
4,934
# frozen_string_literal: true module Mongoid # Provides shared behavior for any document with "pluck" functionality. # # @api private module Pluckable extend ActiveSupport::Concern private # Prepares the field names for plucking by normalizing them to their # database field names. Also prepar...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/persistable.rb
Ruby
mit
3,920
master
10,231
# frozen_string_literal: true require 'mongoid/persistable/creatable' require 'mongoid/persistable/deletable' require 'mongoid/persistable/destroyable' require 'mongoid/persistable/incrementable' require 'mongoid/persistable/logical' require 'mongoid/persistable/maxable' require 'mongoid/persistable/minable' require '...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/stringified_symbol.rb
Ruby
mit
3,920
master
1,547
# frozen_string_literal: true module Mongoid # A class which sends values to the database as Strings but returns # them to the user as Symbols. class StringifiedSymbol class << self # Convert the object from its mongo friendly ruby type to this type. # # @example Demongoize the object. ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/deprecable.rb
Ruby
mit
3,920
master
1,443
# frozen_string_literal: true require 'mongoid/deprecation' module Mongoid # Adds ability to declare Mongoid-specific deprecations. # # @api private module Deprecable # Declares method(s) as deprecated. # # @example Deprecate a method. # Mongoid.deprecate(Cat, :meow); Cat.new.meow # #=...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/utils.rb
Ruby
mit
3,920
master
1,659
# frozen_string_literal: true module Mongoid # Utility functions for Mongoid. # # @api private module Utils extend self # A unique placeholder value that will never accidentally collide with # valid values. This is useful as a default keyword argument value when # you want the argument to be o...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/loggable.rb
Ruby
mit
3,920
master
1,362
# frozen_string_literal: true module Mongoid # Contains logging behavior. module Loggable # Get the logger. # # @note Will try to grab Rails' logger first before creating a new logger # with stderr. # # @example Get the logger. # Loggable.logger # # @return [ Logger ] The lo...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/reloadable.rb
Ruby
mit
3,920
master
3,522
# frozen_string_literal: true module Mongoid # This module handles reloading behavior of documents. module Reloadable # Reloads the +Document+ attributes from the database. If the document has # not been saved then an error will get raised if the configuration option # was set. This can reload root doc...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/indexable.rb
Ruby
mit
3,920
master
4,920
# frozen_string_literal: true require 'mongoid/indexable/specification' require 'mongoid/indexable/validators/options' require 'ostruct' module Mongoid # Encapsulates behavior around defining indexes. module Indexable extend ActiveSupport::Concern included do cattr_accessor :index_specifications ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/scopable.rb
Ruby
mit
3,920
master
10,148
# frozen_string_literal: true module Mongoid # This module contains behavior for all Mongoid scoping - named scopes, # default scopes, and criteria accessors via scoped and unscoped. module Scopable extend ActiveSupport::Concern included do class_attribute :default_scoping class_attribute :_...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/criteria.rb
Ruby
mit
3,920
master
22,356
# frozen_string_literal: true require 'mongoid/criteria/findable' require 'mongoid/criteria/includable' require 'mongoid/criteria/inspectable' require 'mongoid/criteria/marshalable' require 'mongoid/criteria/modifiable' require 'mongoid/criteria/queryable' require 'mongoid/criteria/scopable' require 'mongoid/criteria/...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/attributes.rb
Ruby
mit
3,920
master
12,967
# frozen_string_literal: true require 'active_model/attribute_methods' require 'mongoid/attributes/dynamic' require 'mongoid/attributes/embedded' require 'mongoid/attributes/nested' require 'mongoid/attributes/processing' require 'mongoid/attributes/projector' require 'mongoid/attributes/readonly' module Mongoid # ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/persistence_context.rb
Ruby
mit
3,920
master
10,727
# frozen_string_literal: true module Mongoid # Object encapsulating logic for setting/getting a collection and database name # and a client with particular options to use when persisting models. class PersistenceContext extend Forwardable # Delegate the cluster method to the client. def_delegators :...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/serializable.rb
Ruby
mit
3,920
master
5,982
# frozen_string_literal: true module Mongoid # This module provides the extra behavior for including associations in JSON # and XML serialization. module Serializable extend ActiveSupport::Concern # We need to redefine where the JSON configuration is getting defined, # similar to +ActiveRecord+. ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/search_indexable.rb
Ruby
mit
3,920
master
20,753
# frozen_string_literal: true module Mongoid # Encapsulates behavior around managing search indexes. This feature # is only supported when connected to an Atlas cluster. module SearchIndexable extend ActiveSupport::Concern # Represents the status of the indexes returned by a search_indexes # call. ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/railtie.rb
Ruby
mit
3,920
master
4,564
# frozen_string_literal: true require 'rails' require 'rails/mongoid' module Rails module Mongoid # Hooks Mongoid into Rails 3 and higher. class Railtie < Rails::Railtie console do |app| if app.sandbox? require 'mongoid/railties/console_sandbox' start_sandbox end ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/changeable.rb
Ruby
mit
3,920
master
17,746
# frozen_string_literal: true module Mongoid # Defines behavior for dirty tracking. module Changeable extend ActiveSupport::Concern # Get the changed attributes for the document. # # @example Get the changed attributes. # model.changed # # @return [ Array<String> ] The changed attrib...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/identifiable.rb
Ruby
mit
3,920
master
1,083
# frozen_string_literal: true require 'mongoid/model_resolver' module Mongoid # Implements the "identify_as" interface (for specifying type aliases # for document classes). module Identifiable extend ActiveSupport::Concern class_methods do # Specifies aliases that may be used to identify this doc...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/extensions.rb
Ruby
mit
3,920
master
960
# frozen_string_literal: true require 'mongoid/extensions/array' require 'mongoid/extensions/big_decimal' require 'mongoid/extensions/binary' require 'mongoid/extensions/boolean' require 'mongoid/extensions/date' require 'mongoid/extensions/date_time' require 'mongoid/extensions/decimal128' require 'mongoid/extensions...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/matchable.rb
Ruby
mit
3,920
master
668
# frozen_string_literal: true module Mongoid # This module contains all the behavior for Ruby implementations of MongoDB # selectors. module Matchable extend ActiveSupport::Concern # Determines if this document has the attributes to match the supplied # MongoDB selector. Used for matching on embedde...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/contextual.rb
Ruby
mit
3,920
master
2,630
# frozen_string_literal: true require 'mongoid/contextual/queryable' require 'mongoid/contextual/mongo' require 'mongoid/contextual/memory' require 'mongoid/contextual/none' module Mongoid # Parent mixin module which adds aggregation (#sum, #avg, etc.) and # atomic (#set, #unset, #push, etc.) behavior to Mongoid:...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/factory.rb
Ruby
mit
3,920
master
9,880
# frozen_string_literal: true module Mongoid # Instantiates documents that came from the database. module Factory extend self # A helper class for instantiating a model using either its type # class directly, or via a type class specified via a discriminator # key. # # @api private cla...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/clients.rb
Ruby
mit
3,920
master
3,097
# frozen_string_literal: true require 'mongoid/clients/factory' require 'mongoid/clients/validators' require 'mongoid/clients/storage_options' require 'mongoid/clients/options' require 'mongoid/clients/sessions' module Mongoid # Mixin module included into Mongoid::Document which adds # database client connection ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/inspectable.rb
Ruby
mit
3,920
master
2,372
# frozen_string_literal: true module Mongoid # Contains the behavior around inspecting documents via inspect. module Inspectable # Returns the class name plus its attributes. If using dynamic fields will # include those as well. # # @example Inspect the document. # person.inspect # # ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/deprecation.rb
Ruby
mit
3,920
master
761
# frozen_string_literal: true module Mongoid # Utility class for logging deprecation warnings. class Deprecation < ::ActiveSupport::Deprecation def initialize # Per change policy, deprecations will be removed in the next major version. deprecation_horizon = "#{Mongoid::VERSION.split('.').first.to_i...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/errors.rb
Ruby
mit
3,920
master
3,543
# frozen_string_literal: true require 'mongoid/errors/mongoid_error' require 'mongoid/errors/ambiguous_relationship' require 'mongoid/errors/attribute_not_loaded' require 'mongoid/errors/callback' require 'mongoid/errors/create_collection_failure' require 'mongoid/errors/criteria_argument_required' require 'mongoid/er...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/association.rb
Ruby
mit
3,920
master
4,426
# frozen_string_literal: true require 'mongoid/association/accessors' require 'mongoid/association/builders' require 'mongoid/association/bindable' require 'mongoid/association/depending' require 'mongoid/association/proxy' require 'mongoid/association/many' require 'mongoid/association/one' require 'mongoid/associat...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/evolvable.rb
Ruby
mit
3,920
master
363
# frozen_string_literal: true module Mongoid # Contains behavior specific to evolving for queryable queries. module Evolvable # Evolve the document into an object id. # # @example Evolve the document. # document.__evolve_object_id__ # # @return [ Object ] The document's id. def __evol...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/warnings.rb
Ruby
mit
3,920
master
1,986
# frozen_string_literal: true module Mongoid # Encapsulates behavior around logging and caching warnings so they are only # logged once. # # @api private module Warnings class << self # Define a warning message method for the given id. # # @param [ Symbol ] id The warning identifier. ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/matcher.rb
Ruby
mit
3,920
master
5,671
module Mongoid # Utility module containing methods which assist in performing # in-memory matching of documents with MQL query expressions. # # @api private module Matcher # Extracts field values in the document at the specified key. # # The document can be a Hash or a model instance. # # ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/findable.rb
Ruby
mit
3,920
master
9,446
# frozen_string_literal: true module Mongoid # This module defines the finder methods that hang off the document at the # class level. module Findable extend Forwardable def_delegators :with_default_scope, *( Criteria::Queryable::Selectable.forwardables + Criteria::Queryable::Optional.forwar...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/collection_configurable.rb
Ruby
mit
3,920
master
2,016
# frozen_string_literal: true module Mongoid # Encapsulates behavior around defining collections. module CollectionConfigurable extend ActiveSupport::Concern module ClassMethods # Create the collection for the called upon Mongoid model. # # This method does not re-create existing collect...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/document.rb
Ruby
mit
3,920
master
15,733
# frozen_string_literal: true require 'mongoid/positional' require 'mongoid/evolvable' require 'mongoid/extensions' require 'mongoid/errors' require 'mongoid/threaded' require 'mongoid/atomic' require 'mongoid/attributes' require 'mongoid/contextual' require 'mongoid/copyable' require 'mongoid/equality' require 'mongo...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/interceptable.rb
Ruby
mit
3,920
master
15,168
# frozen_string_literal: true module Mongoid # This module contains all the callback hooks for Mongoid. module Interceptable extend ActiveSupport::Concern CALLBACKS = %i[ after_build after_create after_destroy after_find after_initialize after_save after_touch ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/version.rb
Ruby
mit
3,920
master
258
# frozen_string_literal: true module Mongoid # The current version of Mongoid # # Note that this file is automatically updated via `rake candidate:create`. # Manual changes to this file will be overwritten by that rake task. VERSION = '9.0.2' end
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/fields.rb
Ruby
mit
3,920
master
33,197
# frozen_string_literal: true require 'mongoid/fields/standard' require 'mongoid/fields/encrypted' require 'mongoid/fields/foreign_key' require 'mongoid/fields/localized' require 'mongoid/fields/validators' module Mongoid # This module defines behavior for fields. module Fields extend ActiveSupport::Concern ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/copyable.rb
Ruby
mit
3,920
master
4,032
# frozen_string_literal: true module Mongoid # This module contains the behavior of Mongoid's clone/dup of documents. module Copyable extend ActiveSupport::Concern # Clone or dup the current +Document+. This will return all attributes with # the exception of the document's id, and will reset all the ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/atomic.rb
Ruby
mit
3,920
master
9,944
# frozen_string_literal: true require 'mongoid/atomic/modifiers' require 'mongoid/atomic/paths' module Mongoid # This module contains the logic for supporting atomic operations against the # database. module Atomic extend ActiveSupport::Concern UPDATES = %i[ atomic_array_pushes atomic_array...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/errors/invalid_options.rb
Ruby
mit
3,920
master
731
# frozen_string_literal: true module Mongoid module Errors # Raised when invalid options are passed to an association macro. class InvalidOptions < MongoidError # Instantiate the options error. # # @example Create the error. # InvalidOptions.new(:name, :polymorphic, [ :as ]) #...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/errors/mongoid_error.rb
Ruby
mit
3,920
master
2,854
# frozen_string_literal: true module Mongoid module Errors # Default parent Mongoid error for all custom errors. This handles the base # key for the translations and provides the convenience method for # translating the messages. class MongoidError < StandardError attr_reader :problem, :summary...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/errors/delete_restriction.rb
Ruby
mit
3,920
master
764
# frozen_string_literal: true module Mongoid module Errors # This error is raised when attempting to destroy a model which has # an association with dependency option set to restrict. class DeleteRestriction < MongoidError # Create the new callbacks error. # # @param [ Document ] docume...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/errors/drop_collection_failure.rb
Ruby
mit
3,920
master
632
# frozen_string_literal: true module Mongoid module Errors # Raised when an attempt to drop a collection failed. class DropCollectionFailure < MongoidError # Instantiate the drop collection error. # # @param [ String ] collection_name The name of the collection that # Mongoid failed...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/errors/nested_attributes_metadata_not_found.rb
Ruby
mit
3,920
master
754
# frozen_string_literal: true module Mongoid module Errors # This error is raised when metadata could not be found when defining # nested attributes, or the name was incorrect. class NestedAttributesMetadataNotFound < MongoidError # Create the new metadata error. # # @example Create the...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/errors/invalid_field_operator.rb
Ruby
mit
3,920
master
840
# frozen_string_literal: true module Mongoid module Errors # Raised when invalid field-level operator is passed to an # embedded matcher. class InvalidFieldOperator < InvalidQuery # @api private VALID_OPERATORS = %w[ all elemMatch eq exists gt gte in lt lte ne nin not regex size ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
lib/mongoid/errors/unsaved_document.rb
Ruby
mit
3,920
master
550
# frozen_string_literal: true module Mongoid module Errors # Raised when attempting to call create or create! through a # references_many when the parent document has not been saved. This # prevents the child from getting persisted and immediately being orphaned. class UnsavedDocument < MongoidError ...