Class: GovukComponent::TaskListComponent::TitleComponent

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

Instance Attribute Summary collapse

Attributes inherited from Base

#html_attributes

Instance Method Summary collapse

Methods inherited from Base

#brand, #class_prefix

Constructor Details

#initialize(text: nil, href: nil, hint: nil, id_prefix: nil, count: nil, classes: [], html_attributes: {}) ⇒ TitleComponent

Returns a new instance of TitleComponent.



7
8
9
10
11
12
13
14
15
# File 'app/components/govuk_component/task_list_component/title_component.rb', line 7

def initialize(text: nil, href: nil, hint: nil, id_prefix: nil, count: nil, classes: [], html_attributes: {})
  @text       = text
  @href       = href
  @hint       = hint
  @id_prefix  = id_prefix
  @count      = count

  super(classes:, html_attributes:)
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



5
6
7
# File 'app/components/govuk_component/task_list_component/title_component.rb', line 5

def count
  @count
end

#hintObject (readonly)

Returns the value of attribute hint.



5
6
7
# File 'app/components/govuk_component/task_list_component/title_component.rb', line 5

def hint
  @hint
end

#hrefObject (readonly)

Returns the value of attribute href.



5
6
7
# File 'app/components/govuk_component/task_list_component/title_component.rb', line 5

def href
  @href
end

#id_prefixObject (readonly)

Returns the value of attribute id_prefix.



5
6
7
# File 'app/components/govuk_component/task_list_component/title_component.rb', line 5

def id_prefix
  @id_prefix
end

#textObject (readonly)

Returns the value of attribute text.



5
6
7
# File 'app/components/govuk_component/task_list_component/title_component.rb', line 5

def text
  @text
end

Instance Method Details

#callObject



17
18
19
# File 'app/components/govuk_component/task_list_component/title_component.rb', line 17

def call
  tag.div(**html_attributes) { safe_join([title_content, hint_content]) }
end