module Mongoid::Composable

This module provides inclusions of all behavior in a Mongoid document.

@since 4.0.0

Constants

MODULES
RESERVED_METHOD_NAMES

These are methods names defined in included blocks that may conflict with user-defined association or field names. They won’t be in the list of Module.instance_methods on which the prohibited_methods code below is dependent so we must track them separately.

@return [ Array<Symbol> ] A list of reserved method names.

@since 6.0.0

Public Class Methods

prohibited_methods() click to toggle source

Get a list of methods that would be a bad idea to define as field names or override when including Mongoid::Document.

@example Bad thing!

Mongoid::Components.prohibited_methods

@return [ Array<Symbol> ]

@since 2.1.8

# File lib/mongoid/composable.rb, line 128
def prohibited_methods
  @prohibited_methods ||= MODULES.flat_map do |mod|
    mod.instance_methods.map(&:to_sym)
  end + RESERVED_METHOD_NAMES
end