Class: Spotlight::Blocks::HeadingBlockComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/spotlight/blocks/heading_block_component.rb

Overview

Sir Trevor Heading Block

Instance Attribute Summary collapse

Instance Method Summary collapse

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_blockObject (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_tagObject



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