Class: Liebre::Engine::State

Inherits:
Object
  • Object
show all
Defined in:
lib/liebre/engine/state.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ State

Returns a new instance of State.



5
6
7
8
# File 'lib/liebre/engine/state.rb', line 5

def initialize config
  @config  = config
  @started = Hash.new { |hash, key| hash[key] = {} }
end

Instance Method Details

#to_clean(only: nil) ⇒ Object



19
20
21
22
23
# File 'lib/liebre/engine/state.rb', line 19

def to_clean only: nil
  all do |type, name, opts|
    yield(type, name, opts) if match?(type, only)
  end
end

#to_start(only: nil) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/liebre/engine/state.rb', line 10

def to_start only: nil
  all do |type, name, opts|
    if has_to_start?(type, name, only)
      yield(type, name, opts)
      set_started(type, name)
    end
  end
end