Class: GovukTechDocs::TableOfContents::HeadingsBuilder
- Inherits:
-
Object
- Object
- GovukTechDocs::TableOfContents::HeadingsBuilder
- Defined in:
- lib/govuk_tech_docs/table_of_contents/headings_builder.rb
Instance Method Summary collapse
- #headings ⇒ Object
-
#initialize(html) ⇒ HeadingsBuilder
constructor
A new instance of HeadingsBuilder.
Constructor Details
#initialize(html) ⇒ HeadingsBuilder
Returns a new instance of HeadingsBuilder.
4 5 6 |
# File 'lib/govuk_tech_docs/table_of_contents/headings_builder.rb', line 4 def initialize(html) @html = html end |
Instance Method Details
#headings ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/govuk_tech_docs/table_of_contents/headings_builder.rb', line 8 def headings heading_elements.map do |element| Heading.new( element_name: element.node_name, text: element.content, attributes: convert_nokogiri_attr_objects_to_hashes(element.attributes) ) end end |