module Mongoid::Extensions::Module
Public Instance Methods
re_define_method(name, &block)
click to toggle source
Redefine the method. Will undef the method if it exists or simply just define it.
@example Redefine the method.
Object.re_define_method("exists?") do self end
@param [ String
, Symbol
] name The name of the method. @param [ Proc ] block The method body.
@return [ Method ] The new method.
@since 3.0.0
# File lib/mongoid/extensions/module.rb, line 22 def re_define_method(name, &block) undef_method(name) if method_defined?(name) define_method(name, &block) end