Class: GovukPublishingComponents::Presenters::HeadingHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/govuk_publishing_components/presenters/heading_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ HeadingHelper

Returns a new instance of HeadingHelper.



6
7
8
9
10
11
12
13
14
15
# File 'lib/govuk_publishing_components/presenters/heading_helper.rb', line 6

def initialize(options)
  @id = options[:id]

  @classes = ""
  @classes << heading_size(options[:font_size])
  @classes << " gem-c-heading--mobile-top-margin" if options[:mobile_top_margin]
  @classes << " gem-c-heading--padding" if options[:padding]
  @classes << " gem-c-heading--border-top-#{options[:border_top]}" if [1, 2, 5].include? options[:border_top]
  @classes << " gem-c-heading--inverse" if options[:inverse]
end

Instance Attribute Details

#classesObject (readonly)

Returns the value of attribute classes.



4
5
6
# File 'lib/govuk_publishing_components/presenters/heading_helper.rb', line 4

def classes
  @classes
end

#heading_tagObject (readonly)

Returns the value of attribute heading_tag.



4
5
6
# File 'lib/govuk_publishing_components/presenters/heading_helper.rb', line 4

def heading_tag
  @heading_tag
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/govuk_publishing_components/presenters/heading_helper.rb', line 4

def id
  @id
end