Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/deprecate_public.rb
Defined Under Namespace
Modules: DeprecatePublic
Instance Method Summary collapse
-
#deprecate_public(meth, msg = nil) ⇒ Object
Allow but deprecate public method calls to
meth, ifmethis protected or private.
Instance Method Details
#deprecate_public(meth, msg = nil) ⇒ Object
Allow but deprecate public method calls to meth, if meth is protected or private. meth can be an array of method name strings or symbols to handle multiple methods at once. If msg is specified, it can be used to customize the warning printed.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/deprecate_public.rb', line 26 def deprecate_public(meth, msg=nil) include DeprecatePublic Array(meth).each do |m| = (msg || "calling #{name}##{m} using deprecated public interface").dup.freeze = :"_deprecated_public_message_#{m}" define_method(){} private end nil end |