A library of utility services and concerns.
Tools for working with an application or working environment.
.instance => SleepingKingStudios::Tools::Base
#initialize(deprecation_caller_depth: nil, deprecation_strategy: nil) => CoreTools
#deprecation_caller_depth => Integer (readonly)
#deprecation_strategy => String (readonly)
#deprecate(name, message: nil) => Object
#deprecate(*args, format:, message: nil) => Object
Prints a deprecation warning or raises an exception.
The behavior of this method depends on the configured deprecation strategy, which can be passed to the constructor or configured using the DEPRECATION_STRATEGY environment variable.
CoreTools.deprecate 'ObjectTools#old_method'
#=> prints to stderr:
#
# [WARNING] ObjectTools#old_method is deprecated.
# called from /path/to/file.rb:4: in something_or_other
With An Additional Message
CoreTools.deprecate 'ObjectTools#old_method',
'Use #new_method instead.'
#=> prints to stderr:
#
# [WARNING] ObjectTools#old_method is deprecated. Use #new_method instead.
# called from /path/to/file.rb:4: in something_or_other
With A Format String
CoreTools.deprecate 'ObjectTools#old_method',
'0.1.0',
format: '%s was deprecated in version %s.'
#=> prints to stderr:
#
# ObjectTools#old_method was deprecated in version 0.1.0.
# called from /path/to/file.rb:4: in something_or_other
#deprecate(name, message: nil) => Object
Prints a deprecation warning or raises an exception.
#deprecate(*args, format:, message: nil) => Object
Prints a deprecation warning with the specified format or raises.
#empty_binding => Binding
Generates an empty Binding object with an Object as the receiver.
#require_each(*file_patterns) => Object
Expands each file pattern and requires each file.
Back to Documentation | Reference | SleepingKingStudios | SleepingKingStudios::Tools