Class: Roll::Amp::Style::StyleTag

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

Overview

The style tag.

Direct Known Subclasses

BoilerplateStyleTag, CustomStyleTag

Instance Method Summary collapse

Constructor Details

#initialize(amp_attr, content) ⇒ StyleTag

Initializes new instance of the style tag. to indicate its purpose.

Parameters:

  • amp_attr (String)

    the AMP-specific attribute of the tag

  • content (String)

    the content of the tag.



15
16
17
18
# File 'lib/roll/amp/style/style_tag.rb', line 15

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

Instance Method Details

#to_htmlString

Prints this tag as HTML.

Returns:

  • (String)

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



22
23
24
# File 'lib/roll/amp/style/style_tag.rb', line 22

def to_html
  ('style', raw(@content), @amp_attr => '')
end