Class: RubyLLM::Deprecator

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

Overview

Owns RubyLLM deprecation warnings so applications and tests can decide how aggressively to handle compatibility paths.

Instance Method Summary collapse

Instance Method Details

#deprecate(name, replacement:, removal:) ⇒ Object



18
19
20
# File 'lib/ruby_llm/deprecator.rb', line 18

def deprecate(name, replacement:, removal:)
  warn("#{name} is deprecated and will be removed in RubyLLM #{removal}. Use #{replacement} instead.")
end

#warn(message) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/ruby_llm/deprecator.rb', line 7

def warn(message)
  case RubyLLM.config.deprecation_behavior
  when :silence
    nil
  when :raise
    raise DeprecationError, message
  else
    RubyLLM.logger.warn(message)
  end
end