Class: Liebre::Engine
- Inherits:
-
Object
show all
- Defined in:
- lib/liebre/engine.rb,
lib/liebre/engine/state.rb,
lib/liebre/engine/builder.rb,
lib/liebre/engine/repository.rb
Defined Under Namespace
Classes: Builder, Repository, State
Instance Method Summary
collapse
Constructor Details
#initialize(config) ⇒ Engine
Returns a new instance of Engine.
9
10
11
|
# File 'lib/liebre/engine.rb', line 9
def initialize config
@config = config
end
|
Instance Method Details
#clean(only: nil) ⇒ Object
24
25
26
27
28
29
30
31
|
# 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 ⇒ Object
39
40
41
|
# File 'lib/liebre/engine.rb', line 39
def repo
@repo ||= Repository.new
end
|
#start(only: nil) ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# 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 ⇒ Object
33
34
35
36
37
|
# File 'lib/liebre/engine.rb', line 33
def stop
repo.each(&:stop)
repo.clear
bridge.stop
end
|