Class: GovukComponent::StartButtonComponent
- Defined in:
- app/components/govuk_component/start_button_component.rb
Instance Attribute Summary collapse
-
#as_button ⇒ Object
readonly
Returns the value of attribute as_button.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(text:, href:, as_button: config.default_start_button_as_button, classes: [], html_attributes: {}) ⇒ StartButtonComponent
constructor
A new instance of StartButtonComponent.
Methods inherited from Base
Constructor Details
#initialize(text:, href:, as_button: config.default_start_button_as_button, classes: [], html_attributes: {}) ⇒ StartButtonComponent
Returns a new instance of StartButtonComponent.
4 5 6 7 8 9 10 |
# File 'app/components/govuk_component/start_button_component.rb', line 4 def initialize(text:, href:, as_button: config., classes: [], html_attributes: {}) @text = text @href = href @as_button = super(classes:, html_attributes:) end |
Instance Attribute Details
#as_button ⇒ Object (readonly)
Returns the value of attribute as_button.
2 3 4 |
# File 'app/components/govuk_component/start_button_component.rb', line 2 def @as_button end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
2 3 4 |
# File 'app/components/govuk_component/start_button_component.rb', line 2 def href @href end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'app/components/govuk_component/start_button_component.rb', line 2 def text @text end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/components/govuk_component/start_button_component.rb', line 12 def call if (href, **html_attributes) do safe_join([text, icon]) end else link_to(href, **html_attributes) do safe_join([text, icon]) end end end |