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
24 25 26 |
# File 'lib/view_component/scoped_styles/railtie.rb', line 24 def component_path Rails.root.join("app/components/**/*.rb") end |
.load_and_register_components ⇒ Object
28 29 30 31 32 |
# File 'lib/view_component/scoped_styles/railtie.rb', line 28 def load_and_register_components Dir[component_path].each { require_dependency _1 } register_components end |
.register_components ⇒ Object
34 35 36 37 38 39 |
# File 'lib/view_component/scoped_styles/railtie.rb', line 34 def register_components ObjectSpace .each_object(Class) .select { _1.ancestors.include?(ViewComponent::ScopedStyles) } .each(&:register_styles) end |