Module: Yoda::HasServices::ClassMethods
- Defined in:
- lib/yoda/has_services.rb
Instance Method Summary collapse
-
#service(name, &block) ⇒ Object
Register a service with the specified name.
- #service_hub_class ⇒ Class<ServiceHub>
Instance Method Details
#service(name, &block) ⇒ Object
Register a service with the specified name
6 7 8 9 |
# File 'lib/yoda/has_services.rb', line 6 def service(name, &block) service_hub_class.register_service(name, &block) define_method(:"#{name}_service") { services.public_send(name) } end |
#service_hub_class ⇒ Class<ServiceHub>
12 13 14 |
# File 'lib/yoda/has_services.rb', line 12 def service_hub_class @service_hub_class ||= Class.new(ServiceHub) end |