Class: RailsApiKeys::UI::MountRegistry
- Inherits:
-
Object
- Object
- RailsApiKeys::UI::MountRegistry
- Defined in:
- lib/rails_api_keys/ui/mount_registry.rb
Overview
Stores per-draw-helper options (owner resolution, authorize, etc.). Route defaults only carry the mount name; procs live here.
Instance Method Summary collapse
- #clear! ⇒ Object
- #fetch(name) ⇒ Object
-
#initialize ⇒ MountRegistry
constructor
A new instance of MountRegistry.
- #register(name, options) ⇒ Object
Constructor Details
#initialize ⇒ MountRegistry
Returns a new instance of MountRegistry.
8 9 10 |
# File 'lib/rails_api_keys/ui/mount_registry.rb', line 8 def initialize @mounts = {} end |
Instance Method Details
#clear! ⇒ Object
23 24 25 |
# File 'lib/rails_api_keys/ui/mount_registry.rb', line 23 def clear! @mounts.clear end |
#fetch(name) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/rails_api_keys/ui/mount_registry.rb', line 16 def fetch(name) @mounts.fetch(name.to_s) do raise KeyError, "Unknown rails_api_keys_ui mount #{name.inspect}. " \ "Did routes reload without re-registering?" end end |
#register(name, options) ⇒ Object
12 13 14 |
# File 'lib/rails_api_keys/ui/mount_registry.rb', line 12 def register(name, ) @mounts[name.to_s] = .dup end |