Module: DeprecationToolkit::Behaviors::Raise

Extended by:
Raise
Included in:
Raise
Defined in:
lib/deprecation_toolkit/behaviors/raise.rb

Instance Method Summary collapse

Instance Method Details

#trigger(_test, current_deprecations, recorded_deprecations) ⇒ Object

Raises:

  • (error_class)


8
9
10
11
12
13
14
15
16
17
18
# File 'lib/deprecation_toolkit/behaviors/raise.rb', line 8

def trigger(_test, current_deprecations, recorded_deprecations)
  error_class = if current_deprecations.size > recorded_deprecations.size
    DeprecationIntroduced
  elsif current_deprecations.size < recorded_deprecations.size
    DeprecationRemoved
  else
    DeprecationMismatch
  end

  raise error_class.new(current_deprecations, recorded_deprecations)
end