Module: Ramaze::SourceReloadHooks

Defined in:
lib/ramaze/sourcereload.rb

Overview

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

Class Method Summary collapse

Class Method Details

.after_reloadObject

Overwrite to add actions after the reload cycle has ended.



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

def after_reload
end

.after_safe_load(file) ⇒ Object

Overwrite to add custom hook in addition to default Cache cleaning



159
160
# File 'lib/ramaze/sourcereload.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.



165
166
167
# File 'lib/ramaze/sourcereload.rb', line 165

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.



150
151
152
153
154
155
# File 'lib/ramaze/sourcereload.rb', line 150

def after_safe_load_succeed(file)
  Cache.compiled.clear
  Cache.resolved.clear
  Cache.action_methods.clear
  SourceReloadHooks.after_safe_load(file)
end

.before_reloadObject

Overwrite to add actions before the reload cycle is started.



134
135
# File 'lib/ramaze/sourcereload.rb', line 134

def before_reload
end

.before_safe_load(file) ⇒ Object

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



144
145
# File 'lib/ramaze/sourcereload.rb', line 144

def before_safe_load(file)
end