Module: FHIR::STU3::Deprecate
- Included in:
- Boot::Template, Definitions, Model, StructureDefinition, Xml
- Defined in:
- lib/fhir_stu3_models/deprecate.rb
Overview
add support for deprecating instance and class methods
Instance Method Summary collapse
Instance Method Details
#deprecate(old_method, new_method) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fhir_stu3_models/deprecate.rb', line 5 def deprecate(old_method, new_method) if instance_methods.include? new_method define_method(old_method) do |*args, &block| = "DEPRECATED: `#{old_method}` has been deprecated. Use `#{new_method}` instead. Called from #{caller.first}" FHIR::STU3.logger.warn send(new_method, *args, &block) end end return unless methods.include? new_method (class << self; self; end).instance_eval do define_method(old_method) do |*args, &block| = "DEPRECATED: `#{old_method}` has been deprecated. Use `#{new_method}` instead. Called from #{caller.first}" FHIR::STU3.logger.warn send(new_method, *args, &block) end end end |