class Challah::Plugins::Plugin
A simple DSL for registering a plugin
Attributes
action_controller[R]
active_record[R]
user_extensions[R]
user_init_methods[R]
Public Class Methods
new()
click to toggle source
# File lib/challah/plugins.rb, line 8 def initialize @active_record ||= [] @action_controller ||= [] @user_extensions ||= [] @user_init_methods ||= [] end
Public Instance Methods
extend_user(module_name, init_method = nil)
click to toggle source
Pass a module name to include it in the base User model after challah_user is run
# File lib/challah/plugins.rb, line 23 def extend_user(module_name, init_method = nil) @user_extensions << module_name @user_init_methods << init_method unless init_method.nil? end
on_load(framework, &block)
click to toggle source
When active_record
or action_controller
is loaded, run the given block
# File lib/challah/plugins.rb, line 16 def on_load(framework, &block) return unless [ :active_record, :action_controller ].include?(framework) instance_variable_get("@#{framework}") << block end