Class: SidebarRegistry
- Inherits:
-
Object
- Object
- SidebarRegistry
- Defined in:
- lib/sidebar_registry.rb
Class Method Summary collapse
- .available_sidebar_types ⇒ Object
- .available_sidebars ⇒ Object
- .register_sidebar(klass_name) ⇒ Object
- .register_sidebar_directory(plugins_root, paths) ⇒ Object
Class Method Details
.available_sidebar_types ⇒ Object
11 12 13 |
# File 'lib/sidebar_registry.rb', line 11 def .sort end |
.available_sidebars ⇒ Object
7 8 9 |
# File 'lib/sidebar_registry.rb', line 7 def .sort.map(&:constantize) end |
.register_sidebar(klass_name) ⇒ Object
3 4 5 |
# File 'lib/sidebar_registry.rb', line 3 def (klass_name) << klass_name.to_s end |
.register_sidebar_directory(plugins_root, paths) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sidebar_registry.rb', line 15 def (plugins_root, paths) separator = plugins_root.include?('/') ? '/' : '\\' Dir.glob(File.join(plugins_root, '*_sidebar')).select do |file| plugin_name = file.split(separator).last plugin_name.classify # TODO: Move Sidebars to app/models, and views to app/views so this can # be simplified. paths << File.join(plugins_root, plugin_name, 'lib') end end |