Class: ActiveSupport::Messages::RotationCoordinator
  
  
  
  
  
    - Inherits:
 
    - 
      Object
      
        
          - Object
 
          
            - ActiveSupport::Messages::RotationCoordinator
 
          
        
        show all
      
     
  
  
  
  
  
  
  
  
  
  
    - Defined in:
 
    - lib/active_support/messages/rotation_coordinator.rb
 
  
  
 
Overview
  
  Instance Attribute Summary collapse
  
  
    
      Instance Method Summary
      collapse
    
    
  
  Constructor Details
  
    
  
  
    
Returns a new instance of RotationCoordinator.
   
 
  
    
      
10
11
12
13
14
15
16 
     | 
    
      # File 'lib/active_support/messages/rotation_coordinator.rb', line 10
def initialize(&secret_generator)
  raise ArgumentError, "A secret generator block is required" unless secret_generator
  @secret_generator = secret_generator
  @rotate_options = []
  @on_rotation = nil
  @codecs = {}
end
     | 
  
 
  
 
  
    Instance Attribute Details
    
      
      
      
  
  
    #transitional  ⇒ Object 
  
  
  
  
    
Returns the value of attribute transitional.
   
 
  
  
    
      
8
9
10 
     | 
    
      # File 'lib/active_support/messages/rotation_coordinator.rb', line 8
def transitional
  @transitional
end 
     | 
  
 
    
   
  
    Instance Method Details
    
      
  
  
    
      
18
19
20 
     | 
    
      # File 'lib/active_support/messages/rotation_coordinator.rb', line 18
def [](salt)
  @codecs[salt] ||= build_with_rotations(salt)
end 
     | 
  
 
    
      
  
  
    #[]=(salt, codec)  ⇒ Object 
  
  
  
  
    
      
22
23
24 
     | 
    
      # File 'lib/active_support/messages/rotation_coordinator.rb', line 22
def []=(salt, codec)
  @codecs[salt] = codec
end 
     | 
  
 
    
      
  
  
    #clear_rotations  ⇒ Object 
  
  
  
  
    
      
48
49
50
51
52 
     | 
    
      # File 'lib/active_support/messages/rotation_coordinator.rb', line 48
def clear_rotations
  changing_configuration!
  @rotate_options.clear
  self
end 
     | 
  
 
    
      
  
  
    #on_rotation(&callback)  ⇒ Object 
  
  
  
  
    
      
54
55
56
57 
     | 
    
      # File 'lib/active_support/messages/rotation_coordinator.rb', line 54
def on_rotation(&callback)
  changing_configuration!
  @on_rotation = callback
end 
     | 
  
 
    
      
  
  
    #prepend(**options, &block)  ⇒ Object 
  
  
  
  
    
      
35
36
37
38
39
40
41
42 
     | 
    
      # File 'lib/active_support/messages/rotation_coordinator.rb', line 35
def prepend(**options, &block)
  raise ArgumentError, "Options cannot be specified when using a block" if block && !options.empty?
  changing_configuration!
  @rotate_options.unshift(block || options)
  self
end 
     | 
  
 
    
      
  
  
    #rotate(**options, &block)  ⇒ Object 
  
  
  
  
    
      
26
27
28
29
30
31
32
33 
     | 
    
      # File 'lib/active_support/messages/rotation_coordinator.rb', line 26
def rotate(**options, &block)
  raise ArgumentError, "Options cannot be specified when using a block" if block && !options.empty?
  changing_configuration!
  @rotate_options << (block || options)
  self
end 
     | 
  
 
    
      
  
  
    #rotate_defaults  ⇒ Object 
  
  
  
  
    
      
44
45
46 
     | 
    
      # File 'lib/active_support/messages/rotation_coordinator.rb', line 44
def rotate_defaults
  rotate()
end 
     |