Class: Testable::Deprecator

Inherits:
Object show all
Defined in:
lib/testable/deprecator.rb

Class Method Summary collapse

Class Method Details

.deprecate(current, upcoming = nil, known_version = nil) ⇒ Object

This is used to indicate that certain functionality within Testable has been deprecated and the previous functionality will disappear.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/testable/deprecator.rb', line 6

def deprecate(current, upcoming = nil, known_version = nil)
  if upcoming
    warn(
      "#{current} is being deprecated and should no longer be used. \
      Use #{upcoming} instead."
    )
  else
    warn("#{current} is being deprecated and should no longer be used.")
  end

  warn(
    "#{current} will be removed in Testable #{known_version}."
  ) if known_version
end

.soft_deprecate(current, reason, known_version, upcoming = nil) ⇒ Object

This is used to indicate that certain functionality within Testable has been soft deprecated, meaning that some aspect of how the framework is configured has changed and that change will become the new default behavior in a given version.



25
26
27
28
29
30
31
32
33
# File 'lib/testable/deprecator.rb', line 25

def soft_deprecate(current, reason, known_version, upcoming = nil)
  debug("The #{current} method is changing and is now configurable.")
  debug("REASON: #{reason}.")
  debug(
    "Moving forwards into Testable #{known_version}, \
    the default behavior will change."
  )
  debug("It is advised that you change to using #{upcoming}") if upcoming
end