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.



184
# File 'lib/ramaze/reloader.rb', line 184

def after_cycle; end

#after_safe_load(file) ⇒ Object

Overwrite to add custom hook in addition to default Cache cleaning



200
201
# File 'lib/ramaze/reloader.rb', line 200

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.



205
206
207
# File 'lib/ramaze/reloader.rb', line 205

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.



194
195
196
197
# File 'lib/ramaze/reloader.rb', line 194

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.



181
# File 'lib/ramaze/reloader.rb', line 181

def before_cycle; end

#before_safe_load(file) ⇒ Object

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



187
188
189
# File 'lib/ramaze/reloader.rb', line 187

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