Class: ActiveStorage::Service::Registry
- Inherits:
- 
      Object
      
        - Object
- ActiveStorage::Service::Registry
 
- Defined in:
- lib/active_storage/service/registry.rb
Overview
:nodoc:
Instance Method Summary collapse
- #fetch(name) ⇒ Object
- 
  
    
      #initialize(configurations)  ⇒ Registry 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Registry. 
Constructor Details
#initialize(configurations) ⇒ Registry
Returns a new instance of Registry.
| 5 6 7 8 | # File 'lib/active_storage/service/registry.rb', line 5 def initialize(configurations) @configurations = configurations.deep_symbolize_keys @services = {} end | 
Instance Method Details
#fetch(name) ⇒ Object
| 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # File 'lib/active_storage/service/registry.rb', line 10 def fetch(name) services.fetch(name.to_sym) do |key| if configurations.include?(key) services[key] = configurator.build(key) else if block_given? yield key else raise KeyError, "Missing configuration for the #{key} Active Storage service. " \ "Configurations available for the #{configurations.keys.to_sentence} services." end end end end |