Class: Koch::Resources
- Inherits:
-
Array
- Object
- Array
- Koch::Resources
- Defined in:
- lib/koch/resources.rb
Overview
Represents a list of resources
Instance Method Summary collapse
- #apply! ⇒ Object
-
#initialize ⇒ Resources
constructor
A new instance of Resources.
- #on_changes ⇒ Object
- #reloads ⇒ Object
- #restarts ⇒ Object
Constructor Details
#initialize ⇒ Resources
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_changes ⇒ Object
32 33 34 |
# File 'lib/koch/resources.rb', line 32 def on_changes @on_changes.compact.flatten.uniq end |
#reloads ⇒ Object
24 25 26 |
# File 'lib/koch/resources.rb', line 24 def reloads @reloads.compact.flatten.uniq end |
#restarts ⇒ Object
28 29 30 |
# File 'lib/koch/resources.rb', line 28 def restarts @restarts.compact.flatten.uniq end |