module ActiveSupport::Messages::Rotator

def initialize(*, **options)

:nodoc:
def initialize(*, **options)
  super
  @options   = options
  @rotations = []
end

def rotate(*secrets, **options)

def rotate(*secrets, **options)
  @rotations << build_rotation(*secrets, @options.merge(options))
end

def run_rotations(on_rotation)

def run_rotations(on_rotation)
  @rotations.find do |rotation|
    if message = yield(rotation) rescue next
      on_rotation.call if on_rotation
      return message
    end
  end
end