Class: FoxTail::WrapperComponent
Instance Attribute Summary collapse
#html_attributes
Instance Method Summary
collapse
classname_merger, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class
Methods inherited from Base
fox_tail_config
Constructor Details
#initialize(html_attributes = {}, &block) ⇒ WrapperComponent
Returns a new instance of WrapperComponent.
6
7
8
9
|
# File 'app/components/fox_tail/wrapper_component.rb', line 6
def initialize(html_attributes = {}, &block)
super(html_attributes)
@block = block
end
|
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
4
5
6
|
# File 'app/components/fox_tail/wrapper_component.rb', line 4
def block
@block
end
|
Instance Method Details
#before_render ⇒ Object
15
16
17
18
19
|
# File 'app/components/fox_tail/wrapper_component.rb', line 15
def before_render
super
html_attributes[:class] = html_class
end
|
#block? ⇒ Boolean
11
12
13
|
# File 'app/components/fox_tail/wrapper_component.rb', line 11
def block?
!!@block
end
|
#call ⇒ Object
25
26
27
|
# File 'app/components/fox_tail/wrapper_component.rb', line 25
def call
block ? capture(self, &block) : content
end
|
#render? ⇒ Boolean
21
22
23
|
# File 'app/components/fox_tail/wrapper_component.rb', line 21
def render?
block? || content?
end
|