Module: Rack::App::Extension
Instance Method Summary collapse
- #apply_extensions(app_class, applied_ext_names, apply_ext_names) ⇒ Object
- #format_extension_name(extension_name) ⇒ Object
- #register(extension_name, &builder_block) ⇒ Object
Instance Method Details
#apply_extensions(app_class, applied_ext_names, apply_ext_names) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rack/app/extension.rb', line 5 def apply_extensions(app_class, applied_ext_names, apply_ext_names) apply_ext_names.each do |extension_name| extension_name = format_extension_name(extension_name) next if applied_ext_names.include?(extension_name) applied_ext_names << extension_name ext = find_extension_for(extension_name) app_class.class_eval(&ext) end nil end |
#format_extension_name(extension_name) ⇒ Object
19 20 21 |
# File 'lib/rack/app/extension.rb', line 19 def format_extension_name(extension_name) extension_name.to_s.to_sym end |
#register(extension_name, &builder_block) ⇒ Object
23 24 25 |
# File 'lib/rack/app/extension.rb', line 23 def register(extension_name, &builder_block) extensions[format_extension_name(extension_name)]= builder_block end |