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)


31
32
33
# File 'lib/article_json/export/amp/exporter.rb', line 31

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>)


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

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
16
# 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