Class: ServiceBureau::Locations
- Inherits:
-
Object
- Object
- ServiceBureau::Locations
- Defined in:
- lib/service_bureau/locations.rb
Overview
Stores the factories for all the configured services
Class Method Summary collapse
-
.clear ⇒ Hash
Removes all the registered services.
-
.configure { ... } ⇒ Object
Configures the factories for each service.
-
.factory_map ⇒ Hash
private
Gets the map of service keys to factories.
- .method_missing(method_name, *args, &block) ⇒ Object
Class Method Details
.clear ⇒ Hash
Removes all the registered services.
34 35 36 |
# File 'lib/service_bureau/locations.rb', line 34 def clear factory_map.clear end |
.configure { ... } ⇒ Object
Configures the factories for each service
Each service should be configured with an object that responds to ‘call’
19 20 21 |
# File 'lib/service_bureau/locations.rb', line 19 def configure(&block) yield self end |
.factory_map ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Gets the map of service keys to factories.
27 28 29 |
# File 'lib/service_bureau/locations.rb', line 27 def factory_map @factory_map ||= {} end |
.method_missing(method_name, *args, &block) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/service_bureau/locations.rb', line 39 def method_missing(method_name, *args, &block) if args.size == 1 && !block_given? factory_map[method_name] = args.first else super end end |