Class: GovukComponent::InsetText

Inherits:
Base
  • Object
show all
Defined in:
app/components/govuk_component/inset_text.rb

Instance Attribute Summary collapse

Attributes included from Traits::CustomHtmlAttributes

#html_attributes

Instance Method Summary collapse

Methods inherited from Base

wrap_slot

Methods included from Traits::CustomClasses

#classes

Constructor Details

#initialize(text:, classes: [], html_attributes: {}) ⇒ InsetText

Returns a new instance of InsetText.



4
5
6
7
8
# File 'app/components/govuk_component/inset_text.rb', line 4

def initialize(text:, classes: [], html_attributes: {})
  super(classes: classes, html_attributes: html_attributes)

  @text = text
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



2
3
4
# File 'app/components/govuk_component/inset_text.rb', line 2

def text
  @text
end

Instance Method Details

#callObject



10
11
12
# File 'app/components/govuk_component/inset_text.rb', line 10

def call
  tag.div(class: classes, **html_attributes) { @text }
end