Module: Ramaze::Reloader::Hooks

Included in:
Ramaze::Reloader
Defined in:
lib/ramaze/reloader.rb

Overview

Holds hooks that are called before and after #cycle and #safe_load

Instance Method Summary collapse

Instance Method Details

#after_cycleObject

Overwrite to add actions after the reload rotation has ended.



143
144
# File 'lib/ramaze/reloader.rb', line 143

def after_cycle
end

#after_safe_load(file) ⇒ Object

Overwrite to add custom hook in addition to default Cache cleaning



159
160
# File 'lib/ramaze/reloader.rb', line 159

def after_safe_load(file)
end

#after_safe_load_failed(file, error) ⇒ Object

Overwrite to add actions after a file is Kernel::load-ed unsuccessfully, by default we output an error-message with the exception.



164
165
166
# File 'lib/ramaze/reloader.rb', line 164

def after_safe_load_failed(file, error)
  Log.error(error)
end

#after_safe_load_succeed(file) ⇒ Object

Overwrite to add actions after a file is Kernel::load-ed successfully, by default we clean the Cache for compiled templates and resolved actions.



153
154
155
156
# File 'lib/ramaze/reloader.rb', line 153

def after_safe_load_succeed(file)
  Cache.clear_after_reload
  after_safe_load(file)
end

#before_cycleObject

Overwrite to add actions before the reload rotation is started.



139
140
# File 'lib/ramaze/reloader.rb', line 139

def before_cycle
end

#before_safe_load(file) ⇒ Object

Overwrite to add actions before a file is Kernel::load-ed



147
148
149
# File 'lib/ramaze/reloader.rb', line 147

def before_safe_load(file)
  Log.debug("reload #{file}")
end