Class: GovukComponent::InsetTextComponent
- Defined in:
- app/components/govuk_component/inset_text_component.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(text: nil, id: nil, classes: [], html_attributes: {}) ⇒ InsetTextComponent
constructor
A new instance of InsetTextComponent.
- #render? ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(text: nil, id: nil, classes: [], html_attributes: {}) ⇒ InsetTextComponent
Returns a new instance of InsetTextComponent.
4 5 6 7 8 9 |
# File 'app/components/govuk_component/inset_text_component.rb', line 4 def initialize(text: nil, id: nil, classes: [], html_attributes: {}) @text = text @id = id super(classes:, html_attributes:) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'app/components/govuk_component/inset_text_component.rb', line 2 def id @id end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'app/components/govuk_component/inset_text_component.rb', line 2 def text @text end |
Instance Method Details
#call ⇒ Object
11 12 13 |
# File 'app/components/govuk_component/inset_text_component.rb', line 11 def call tag.div(id:, **html_attributes) { inset_text_content } end |
#render? ⇒ Boolean
15 16 17 |
# File 'app/components/govuk_component/inset_text_component.rb', line 15 def render? inset_text_content.present? end |