Module: Ptimelog::DeprecationWarning

Included in:
Script
Defined in:
lib/ptimelog/deprecation_warning.rb

Overview

Allow to add some (hopefully) helpful deprecation warning

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
# File 'lib/ptimelog/deprecation_warning.rb', line 6

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

Instance Method Details

#deprecate(*args) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/ptimelog/deprecation_warning.rb', line 25

def deprecate(*args)
  warn deprecate_header(*args)

  return if self.class.deprecation_warning_rendered?

  warn deprecate_message(*args)
  self.class.deprecation_warning_rendered!
end

#deprecate_header(_) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/ptimelog/deprecation_warning.rb', line 34

def deprecate_header(_)
  raise "    deprecate_header(args) not implemented\n\n    Please define a header/short-info for the deprecation, rendered every\n    time the deprecation is hit.\n  MESSAGE\nend\n"

#deprecate_message(_) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/ptimelog/deprecation_warning.rb', line 43

def deprecate_message(_)
  raise "    deprecate_message(args) not implemented\n\n    Please define a message () for the deprecation, rendered only the first\n    time the deprecation is hit.\n  MESSAGE\nend\n"