123456789_123456789_123456789_123456789_123456789_

Module: Mongoid::Warnings Private

Do not use. This module is for internal use only.
Relationships & Source Files
Defined in: lib/mongoid/warnings.rb

Overview

Encapsulates behavior around logging and caching warnings so they are only logged once.

Class Method Summary

Class Method Details

.warning(id, message)

Define a warning message method for the given id.

Parameters:

  • id (Symbol)

    The warning identifier.

  • message (String)

    The warning message.

[ GitHub ]

  
# File 'lib/mongoid/warnings.rb', line 20

def warning(id, message)
  singleton_class.class_eval do
    define_method("warn_#{id}") do
      unless instance_variable_get("@#{id}")
        Mongoid.logger.warn(message)
        instance_variable_set("@#{id}", true)
      end
    end
  end
end