Class: NitroKit::Typeset

Inherits:
Component
  • Object
show all
Defined in:
app/components/nitro_kit/typeset.rb

Constant Summary

Constants inherited from Component

Component::ADDITIVE_DATA_ATTRIBUTES, Component::COMPONENT_OWNED_DATA_ATTRIBUTES, Component::FORBIDDEN_ATTRIBUTES, Component::RESERVED_DATA_ATTRIBUTES

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, html: {}, aria: {}, data: {}, desperately_need_a_class: nil) ⇒ Typeset

Returns a new instance of Typeset.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/components/nitro_kit/typeset.rb', line 5

def initialize(
  id: nil,
  html: {},
  aria: {},
  data: {},
  desperately_need_a_class: nil
)
  super(
    component: :typeset,
    attributes: { id: }.compact,
    html:,
    aria:,
    data:,
    desperately_need_a_class:
  )
end

Instance Method Details

#view_template(&content) ⇒ Object

Raises:

  • (ArgumentError)


22
23
24
25
26
# File 'app/components/nitro_kit/typeset.rb', line 22

def view_template(&content)
  raise ArgumentError, "Typeset requires a content block" unless content

  div(**root_attributes, &content)
end