Class: Yoda::HasServices::ServiceHub

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/has_services.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ ServiceHub

Returns a new instance of ServiceHub.



20
21
22
# File 'lib/yoda/has_services.rb', line 20

def initialize(instance)
  @instance = instance
end

Instance Attribute Details

#instanceObject (readonly)

Returns the value of attribute instance.



18
19
20
# File 'lib/yoda/has_services.rb', line 18

def instance
  @instance
end

Class Method Details

.register_service(name, &block) ⇒ Object



24
25
26
27
28
# File 'lib/yoda/has_services.rb', line 24

def self.register_service(name, &block)
  define_method(name) do
    instance.instance_exec(instance, &block)
  end
end