Module: Morphine::ClassMethods

Defined in:
lib/morphine.rb

Instance Method Summary collapse

Instance Method Details

#register(name, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/morphine.rb', line 13

def register(name, &block)
  define_method name do |*args|
    dependencies[name] ||= instance_exec(*args,&block)
  end

  define_method "#{name}=" do |service|
    dependencies[name] = service
  end
end