Class: ActiveSupport::Messages::RotationCoordinator
- Inherits:
-
Object
- Object
- ActiveSupport::Messages::RotationCoordinator
show all
- Defined in:
- activesupport/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 'activesupport/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 'activesupport/lib/active_support/messages/rotation_coordinator.rb', line 8
def transitional
@transitional
end
|
Instance Method Details
18
19
20
|
# File 'activesupport/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 'activesupport/lib/active_support/messages/rotation_coordinator.rb', line 22
def []=(salt, codec)
@codecs[salt] = codec
end
|
#clear_rotations ⇒ Object
39
40
41
42
43
|
# File 'activesupport/lib/active_support/messages/rotation_coordinator.rb', line 39
def clear_rotations
changing_configuration!
@rotate_options.clear
self
end
|
#on_rotation(&callback) ⇒ Object
45
46
47
48
|
# File 'activesupport/lib/active_support/messages/rotation_coordinator.rb', line 45
def on_rotation(&callback)
changing_configuration!
@on_rotation = callback
end
|
#rotate(**options, &block) ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'activesupport/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
35
36
37
|
# File 'activesupport/lib/active_support/messages/rotation_coordinator.rb', line 35
def rotate_defaults
rotate()
end
|