Class: GovukComponent::TaskListComponent::StatusComponent

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

Instance Attribute Summary collapse

Attributes inherited from Base

#html_attributes

Instance Method Summary collapse

Methods inherited from Base

#brand

Constructor Details

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

Returns a new instance of StatusComponent.



5
6
7
8
9
10
11
# File 'app/components/govuk_component/task_list_component/status_component.rb', line 5

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

  super(classes: classes, html_attributes: html_attributes)
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



3
4
5
# File 'app/components/govuk_component/task_list_component/status_component.rb', line 3

def count
  @count
end

#id_prefixObject (readonly)

Returns the value of attribute id_prefix.



3
4
5
# File 'app/components/govuk_component/task_list_component/status_component.rb', line 3

def id_prefix
  @id_prefix
end

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'app/components/govuk_component/task_list_component/status_component.rb', line 3

def text
  @text
end

Instance Method Details

#callObject



13
14
15
# File 'app/components/govuk_component/task_list_component/status_component.rb', line 13

def call
  tag.div(status_text, **html_attributes)
end

#render?Boolean

Returns:

  • (Boolean)


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

def render?
  status_text.present?
end