Module: Refactor

Defined in:
lib/uv_refactor.rb,
lib/uv_refactor/deprecation.rb

Defined Under Namespace

Modules: Deprecation

Constant Summary collapse

@@deprecation_method =
lambda {|old_method, new_method, klass|
  if klass.instance_methods.include?(old_method)
    Deprecation.remove_old_method(old_method,
                                  klass,
                                  caller(0)[1])
  end
   unless klass.instance_methods.include?(new_method)
    Deprecation.missing_database_entry(new_method,klass)
    define_method(new_method) do
      self.class_eval { attr_accessor new_method }
    end
  end
   define_method(old_method) do |*args, &block|
    Deprecation.
      renaming_warning(old_method,
                       new_method,
                       caller(0)[1])
    send(new_method, *args, &block)
  end
}

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



33
34
35
# File 'lib/uv_refactor.rb', line 33

def self.included(base)
  base.send(:include, Deprecation)
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Refactor)

    the object that the method was called on



29
30
31
# File 'lib/uv_refactor.rb', line 29

def self.setup
  yield self
end