Module: Hoss::Deprecations Private
- Defined in:
- lib/hoss/deprecations.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
Instance Method Details
#deprecate(name, replacement = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hoss/deprecations.rb', line 23 def deprecate(name, replacement = nil) alias_name = "#{name.to_s.chomp('=')}__deprecated_" alias_name += '=' if name.to_s.end_with?('=') class_eval <<-RUBY, __FILE__, __LINE__ + 1 alias :"#{alias_name}" :"#{name}" def #{name}(*args, &block) warn "[HOSS] [DEPRECATED] `#{name}' is being removed. " \ "#{replacement && "See `#{replacement}'."}" \ "\nCalled from \#{caller.first}" send("#{alias_name}", *args, &block) end RUBY end |