Class: ViewComponent::ScopedStyles::Railtie
- Inherits:
-
Rails::Railtie
- Object
- Rails::Railtie
- ViewComponent::ScopedStyles::Railtie
- Defined in:
- lib/view_component/scoped_styles/railtie.rb
Class Method Summary collapse
Class Method Details
.component_path ⇒ Object
19 20 21 |
# File 'lib/view_component/scoped_styles/railtie.rb', line 19 def component_path Rails.root.join("app/components/**/*.rb") end |
.load_and_register_components ⇒ Object
23 24 25 26 27 |
# File 'lib/view_component/scoped_styles/railtie.rb', line 23 def load_and_register_components Dir[component_path].each { require_dependency _1 } register_components end |
.register_components ⇒ Object
29 30 31 32 33 34 |
# File 'lib/view_component/scoped_styles/railtie.rb', line 29 def register_components ObjectSpace .each_object(Class) .select { _1.ancestors.include?(ViewComponent::ScopedStyles) } .each(&:register_styles) end |