Class: Koch::Resources

Inherits:
Array
  • Object
show all
Defined in:
lib/koch/resources.rb

Overview

Represents a list of resources

Instance Method Summary collapse

Constructor Details

#initializeResources

Returns a new instance of Resources.



6
7
8
9
10
11
# File 'lib/koch/resources.rb', line 6

def initialize
  super
  @reloads = []
  @restarts = []
  @on_changes = []
end

Instance Method Details

#apply!Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/koch/resources.rb', line 13

def apply!
  each do |r|
    r.apply!
    next unless r.changed

    @reloads << r.reload
    @restarts << r.restart
    @on_changes << r.on_change
  end
end

#on_changesObject



32
33
34
# File 'lib/koch/resources.rb', line 32

def on_changes
  @on_changes.compact.flatten.uniq
end

#reloadsObject



24
25
26
# File 'lib/koch/resources.rb', line 24

def reloads
  @reloads.compact.flatten.uniq
end

#restartsObject



28
29
30
# File 'lib/koch/resources.rb', line 28

def restarts
  @restarts.compact.flatten.uniq
end