class Liebre::Engine

Attributes

config[R]

Public Class Methods

new(config) click to toggle source
# File lib/liebre/engine.rb, line 9
def initialize config
  @config = config
end

Public Instance Methods

clean(only: nil) click to toggle source
# File lib/liebre/engine.rb, line 24
def clean only: nil
  bridge.start

  state.to_clean(only: only) do |type, name, opts|
    actor = build(type, name, opts)
    actor.clean
  end
end
repo() click to toggle source
# File lib/liebre/engine.rb, line 39
def repo
  @repo ||= Repository.new
end
start(only: nil) click to toggle source
# File lib/liebre/engine.rb, line 13
def start only: nil
  bridge.start

  state.to_start(only: only) do |type, name, opts|
    actor = build(type, name, opts)
    actor.start

    repo.insert(type, name, actor)
  end
end
stop() click to toggle source
# File lib/liebre/engine.rb, line 33
def stop
  repo.each(&:stop)
  repo.clear
  bridge.stop
end

Private Instance Methods

bridge() click to toggle source
# File lib/liebre/engine.rb, line 54
def bridge
  @bridge ||= Bridge.new(config)
end
build(type, name, opts) click to toggle source
# File lib/liebre/engine.rb, line 45
def build type, name, opts
  builder = Builder.new(bridge, type, name, opts, config)
  builder.call
end
state() click to toggle source
# File lib/liebre/engine.rb, line 50
def state
  @state ||= State.new(config.actors)
end