class ServiceBureau::Locations
Stores the factories for all the configured services
Public Class Methods
clear()
click to toggle source
Removes all the registered services.
@return [Hash] the empty factory_map
# File lib/service_bureau/locations.rb, line 34 def clear factory_map.clear end
configure() { |self| ... }
click to toggle source
Configures the factories for each service
Each service should be configured with an object that responds to ‘call’
@example
ServiceBureau::Locations.configure do |c| c.my_service MyService.public_method(:new) c.other_service ->(arg){ OtherService.new(arg) } end
@return nothing @yield ServiceBureau::Locations
@yieldreturn nothing
# File lib/service_bureau/locations.rb, line 19 def configure(&block) yield self end
factory_map()
click to toggle source
@api private Gets the map of service keys to factories.
@return [Hash] mapping service keys to factories
# File lib/service_bureau/locations.rb, line 27 def factory_map @factory_map ||= {} end
method_missing(method_name, *args, &block)
click to toggle source
@private
Calls superclass method
# 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