Module: Refactor::Deprecation

Defined in:
lib/uv_refactor/deprecation.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Constant Summary collapse

Warnings =

—————————————————————-# Warnings —————————————————————-#

[]

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
# File 'lib/uv_refactor/deprecation.rb', line 4

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

.missing_database_entry(new_method, klass) ⇒ Object



26
27
28
# File 'lib/uv_refactor/deprecation.rb', line 26

def missing_database_entry new_method, klass
  refactor_warning "Missing migration for #{klass} **#{new_method}**."
end

.prettify(origin) ⇒ Object



45
46
47
48
# File 'lib/uv_refactor/deprecation.rb', line 45

def prettify(origin)
  stack_trace_line = origin.to_s.split(':in `block').first
#        only_file_and_filenumber = stack_trace_line.gsub(/:in.*$/,"")
end

.refactor_warning(warning) ⇒ Object



40
41
42
43
# File 'lib/uv_refactor/deprecation.rb', line 40

def refactor_warning(warning)
  Warnings << warning
  warn warning
end

.remove_old_method(old_method, klass, origin) ⇒ Object



35
36
37
38
# File 'lib/uv_refactor/deprecation.rb', line 35

def remove_old_method(old_method,klass,origin)
  whereabout = prettify(origin)
  refactor_warning "Remove **#{old_method}** in #{klass}."
end

.renaming_warning(old_method, new_method, origin) ⇒ Object



30
31
32
33
# File 'lib/uv_refactor/deprecation.rb', line 30

def renaming_warning(old_method,new_method,origin)
  whereabout = prettify(origin)
  refactor_warning "Remove **#{old_method}** with **#{new_method}** in #{whereabout}."
end