Class: SitePrism::Deprecator
- Inherits:
-
Object
- Object
- SitePrism::Deprecator
- Defined in:
- lib/site_prism/deprecator.rb
Overview
- SitePrism::Deprecator
Class Method Summary collapse
-
.deprecate(old, new = nil) ⇒ Object
Tells the user that they are using old functionality, which needs removing in the next major version.
-
.soft_deprecate(old, reason, new = nil) ⇒ Object
Tells the user that they are using functionality which is non-optimal The functionality should usually provide a reason for it being poor, as well as an optional way of upgrading to something different.
Class Method Details
.deprecate(old, new = nil) ⇒ Object
Tells the user that they are using old functionality, which needs removing in the next major version
11 12 13 14 15 16 17 18 19 |
# File 'lib/site_prism/deprecator.rb', line 11 def deprecate(old, new = nil) if new warn("#{old} is being deprecated and should no longer be used. Use #{new} instead.") else warn("#{old} is being deprecated and should no longer be used.") end warn("#{old} will be removed in SitePrism v5. You have been warned!") end |
.soft_deprecate(old, reason, new = nil) ⇒ Object
Tells the user that they are using functionality which is non-optimal The functionality should usually provide a reason for it being poor, as well as an optional way of upgrading to something different
NB: As this is bubbled up at debug level, often users will not see this. So it will never be a candidate for removal directly
29 30 31 32 33 34 |
# File 'lib/site_prism/deprecator.rb', line 29 def soft_deprecate(old, reason, new = nil) debug("The #{old} method is changing, as is SitePrism, and is now advised to be changed.") debug("REASON: #{reason}.") debug('Moving forwards into SitePrism v5, the default behaviour will change.') debug("We advise you change to using #{new}") if new end |