Module: Bridgetown::Foundation

Defined in:
bridgetown-foundation/lib/bridgetown-foundation.rb,
bridgetown-foundation/lib/bridgetown/foundation/packages/ansi.rb,
bridgetown-foundation/lib/bridgetown/foundation/core_ext/class.rb,
bridgetown-foundation/lib/bridgetown/foundation/core_ext/string.rb,
bridgetown-foundation/lib/bridgetown/foundation/refine_ext/module.rb,
bridgetown-foundation/lib/bridgetown/foundation/refine_ext/object.rb,
bridgetown-foundation/lib/bridgetown/foundation/refine_ext/string.rb,
bridgetown-foundation/lib/bridgetown/foundation/questionable_string.rb,
bridgetown-foundation/lib/bridgetown/foundation/packages/pid_tracker.rb,
bridgetown-foundation/lib/bridgetown/foundation/packages/safe_translations.rb,
bridgetown-foundation/lib/bridgetown/foundation/refine_ext/deep_duplicatable.rb

Defined Under Namespace

Modules: CoreExt, Packages, RefineExt Classes: QuestionableString

Class Method Summary collapse

Class Method Details

.deprecation_warning(target, name, repl, year, month) ⇒ Object

This is loosly based on the deprecate method in Gem::Deprecate

Parameters:

  • target (Object)
  • name (Symbol)

    e.g. :howdy

  • repl (Symbol)

    e.g. :hello

  • year (Integer)

    e.g. 2025

  • month (Integer)

    e.g. 1 for January



17
18
19
20
21
22
23
24
25
26
27
# File 'bridgetown-foundation/lib/bridgetown-foundation.rb', line 17

def self.deprecation_warning(target, name, repl, year, month) # rubocop:disable Metrics/ParameterLists
  klass = target.is_a?(Module)
  target = klass ? "#{self}." : "#{self.class}#"
  msg = [
    "NOTE: #{target}#{name} is deprecated",
    repl == :none ? " with no replacement" : "; use #{repl} instead",
    format(". It will be removed on or after %4d-%02d.", year, month), # rubocop:disable Style/FormatStringToken
    "\n#{target}#{name} called from #{Gem.location_of_caller.join(":")}",
  ]
  warn "#{msg.join}."
end