Sha256: 765b035ed09fc24064de7cd18b47fa16347e070f5cae16936f4aeef0f53ce5e6

Contents?: true

Size: 662 Bytes

Versions: 4

Compression:

Stored size: 662 Bytes

Contents

module Carioca
  module Injector
    def inject(service: )              
        self.create_methods(service){return Carioca::Registry.get.get_service name: service }
    end

    def register(service: , definition:)
      Carioca::Registry.get.add service: service, definition: definition 
    end

    def services
      Carioca::Registry.get.services
    end

    def active_services
      Carioca::Registry.get.active_services
     end

    def create_methods(name, &block)
      self.define_method name, &block
      self.class.send(:define_method, name, &block)
    end

    def self.extended(base)
      base.include self
     end
    
     

  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
carioca-2.0.4 lib/carioca/mixin.rb
carioca-2.0.3 lib/carioca/mixin.rb
carioca-2.0.2 lib/carioca/mixin.rb
carioca-2.0.1 lib/carioca/mixin.rb