Module: Rails3::Plugin::Extender::Macro
Instance Method Summary collapse
- #after_init(component, &block) ⇒ Object
-
#init_app_railties(app_name, *railties) ⇒ Object
def.
- #with_configuration(&block) ⇒ Object
- #with_engine(name, &block) ⇒ Object
- #with_extension(&block) ⇒ Object
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_init(component, &block) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/r3_plugin_toolbox/macro.rb', line 33 def after_init component, &block type = macro.get_load_type component Rails3::Plugin::Extender.new do extend_rails type do after :initialize do yield self end end end end |
#init_app_railties(app_name, *railties) ⇒ Object
def
44 45 46 47 48 49 50 |
# File 'lib/r3_plugin_toolbox/macro.rb', line 44 def init_app_railties app_name, *railties app = "#{app_name.to_s.camelize}::Application".constantize app.initialize! railties.each do |railtie| macro.get_base_class(railtie).constantize end end |
#with_configuration(&block) ⇒ Object
21 22 23 24 25 |
# File 'lib/r3_plugin_toolbox/macro.rb', line 21 def with_configuration &block if block block.arity < 1 ? Rails.configuration.instance_eval(&block) : block.call(Rails.configuration) end end |