Module: Rails3::PluginExtender::LoadHandler
Constant Summary
Constants included
from Util
Util::ACTIVE_MODULES, Util::INIT
Instance Method Summary
collapse
Methods included from Util
#act_type?, #get_base_class, #get_constant, #get_load_type, #get_module, #make_constant, #rails_const_base
Instance Method Details
#after(type, &block) ⇒ Object
12
13
14
15
16
|
# File 'lib/plugin_toolbox/loader.rb', line 12
def after type, &block
type = type.to_sym
raise ArgumentError, "#{type} is not a valid after hook" if !valid_after_hook? type
load_handling :"after_#{type}", &block
end
|
#before(type, &block) ⇒ Object
6
7
8
9
10
|
# File 'lib/plugin_toolbox/loader.rb', line 6
def before type, &block
type = type.to_sym
raise ArgumentError, "#{type} is not a valid before hook" if !valid_before_hook? type
load_handling :"before_#{type}", &block
end
|
#load_handling(type, &block) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/plugin_toolbox/loader.rb', line 24
def load_handling type, &block
ActiveSupport.on_load type do
extend Rails3::PluginExtender::DSL
instance_eval(&block)
end
end
|
#on_load(type, &block) ⇒ Object
18
19
20
21
22
|
# File 'lib/plugin_toolbox/loader.rb', line 18
def on_load type, &block
type = get_load_type type
raise ArgumentError, "#{type} is not a valid load hook" if !valid_load_hook? type
load_handling type, &block
end
|