Class: Alki::Reload::Reloader

Inherits:
Object
  • Object
show all
Defined in:
lib/alki/reload/reloader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(unloader) ⇒ Reloader

Returns a new instance of Reloader.



6
7
8
9
# File 'lib/alki/reload/reloader.rb', line 6

def initialize(unloader)
  @unloader = unloader
  @hooks = []
end

Instance Attribute Details

#hooksObject (readonly)

Returns the value of attribute hooks.



4
5
6
# File 'lib/alki/reload/reloader.rb', line 4

def hooks
  @hooks
end

Instance Method Details

#reloadObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/alki/reload/reloader.rb', line 11

def reload
  unloadable = @unloader.find_unloadable
  if unloadable
    hooks.each &:call
    @unloader.unload unloadable
    true
  else
    false
  end
end