Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 599 Bytes

using.adoc

File metadata and controls

29 lines (23 loc) · 599 Bytes

Using Assemblies

Assemblies have a new method used to create new assembly instances (like a normal class). Once an instance is created, anything in the assembly is accessible by drilling down into groups.

Given an assembly like this:

require 'alki'
assembly = Alki.create_assembly do
  set :log_io, STDERR
  group :util do
    service :logger do
      require 'logger'
      Logger.new log_io
    end
  end
end

One can use the logger service like so:

instance = assembly.new
instance.util.logger.info "test"

# output: I, [<timestamp>] INFO -- : test