Class: Roll::Amp::Html::AnalyticsTag

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::OutputSafetyHelper, ActionView::Helpers::TagHelper
Defined in:
lib/roll/amp/html/analytics_tag.rb

Overview

The amp-analytics tag.

Direct Known Subclasses

GoogleAnalyticsTag

Instance Method Summary collapse

Constructor Details

#initialize(type, content) ⇒ AnalyticsTag

Initializes new instance of the analytics tag.

Parameters:

  • type (String)

    the type of AMP analytics.

  • content (String)

    the content of the tag.



14
15
16
17
# File 'lib/roll/amp/html/analytics_tag.rb', line 14

def initialize(type, content)
  @type = type
  @content = content
end

Instance Method Details

#to_htmlString

Prints this tag as HTML.

Returns:

  • (String)

    HTML-safe string containing the tag’s HTML view.



21
22
23
# File 'lib/roll/amp/html/analytics_tag.rb', line 21

def to_html
  ('amp-analytics', raw(@content), type: @type)
end