Class: ViewComponentScopedCss::Tag
- Inherits:
-
Object
- Object
- ViewComponentScopedCss::Tag
- Defined in:
- lib/view_component_scoped_css/tag.rb
Overview
style tag for outputting inline css
Instance Method Summary collapse
- #call ⇒ Object
- #css ⇒ Object
-
#initialize(component_class) ⇒ Tag
constructor
A new instance of Tag.
Constructor Details
#initialize(component_class) ⇒ Tag
Returns a new instance of Tag.
8 9 10 |
# File 'lib/view_component_scoped_css/tag.rb', line 8 def initialize(component_class) @component_class = component_class end |
Instance Method Details
#call ⇒ Object
12 13 14 |
# File 'lib/view_component_scoped_css/tag.rb', line 12 def call "<style data-component-name=\"#{@component_class.name}\">#{css}</style>".html_safe end |
#css ⇒ Object
16 17 18 |
# File 'lib/view_component_scoped_css/tag.rb', line 16 def css ViewComponentScopedCss::Loader.new(@component_class).call.html_safe end |