Class: Spotlight::Blocks::HeadingBlockComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Spotlight::Blocks::HeadingBlockComponent
- Defined in:
- app/components/spotlight/blocks/heading_block_component.rb
Overview
Sir Trevor Heading Block
Instance Attribute Summary collapse
-
#heading_block ⇒ Object
readonly
Returns the value of attribute heading_block.
Instance Method Summary collapse
- #heading_tag ⇒ Object
-
#initialize(heading_block:) ⇒ HeadingBlockComponent
constructor
A new instance of HeadingBlockComponent.
Constructor Details
#initialize(heading_block:) ⇒ HeadingBlockComponent
Returns a new instance of HeadingBlockComponent.
7 8 9 10 |
# File 'app/components/spotlight/blocks/heading_block_component.rb', line 7 def initialize(heading_block:) @heading_block = heading_block super end |
Instance Attribute Details
#heading_block ⇒ Object (readonly)
Returns the value of attribute heading_block.
12 13 14 |
# File 'app/components/spotlight/blocks/heading_block_component.rb', line 12 def heading_block @heading_block end |
Instance Method Details
#heading_tag ⇒ Object
18 19 20 21 22 23 |
# File 'app/components/spotlight/blocks/heading_block_component.rb', line 18 def heading_tag return "h#{level}" if html? && valid_level? # h2 was Spotlight's default heading tag for 10+ years. 'h2' end |