Class: ArticleJSON::Export::AMP::Exporter

Inherits:
Object
  • Object
show all
Includes:
Common::HTML::Exporter
Defined in:
lib/article_json/export/amp/exporter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common::HTML::Exporter

#html, #initialize

Class Method Details

.namespaceModule

Return the module namespace this class is nested in

Returns:

  • (Module)


29
30
31
# File 'lib/article_json/export/amp/exporter.rb', line 29

def namespace
  ArticleJSON::Export::AMP
end

Instance Method Details

#amp_librariesArray<String>

Return an array with all the javascript libraries needed for some special AMP tags (like amp-facebook or amp-iframe)

Returns:

  • (Array<String>)


20
21
22
23
24
# File 'lib/article_json/export/amp/exporter.rb', line 20

def amp_libraries
  return @amp_libraries if defined? @amp_libraries
  @amp_libraries =
    CustomElementLibraryResolver.new(custom_element_tags).script_tags
end

#custom_element_tagsArray[Symbol]

List of all used custom element tags, e.g. ‘[:’amp-iframe’]‘

Returns:

  • (Array[Symbol])


9
10
11
12
13
14
15
# File 'lib/article_json/export/amp/exporter.rb', line 9

def custom_element_tags
  return @custom_element_tags if defined? @custom_element_tags
  @custom_element_tags =
    element_exporters
      .flat_map { |element| element.custom_element_tags }
      .uniq
end