Sha256: c517a9655fede896fc0c0c458156af4b3162833d3b987f0975d63b5194251227
Contents?: true
Size: 692 Bytes
Versions: 9
Compression:
Stored size: 692 Bytes
Contents
# frozen_string_literal: true module Mongoid module Extensions module Module # 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. def re_define_method(name, &block) undef_method(name) if method_defined?(name) define_method(name, &block) end end end end ::Module.__send__(:include, Mongoid::Extensions::Module)
Version data entries
9 entries across 9 versions & 1 rubygems