Class: Roadie::Inliner Private

Inherits:
Object
  • Object
show all
Defined in:
lib/roadie/inliner.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The Inliner inlines stylesheets to the elements of the DOM.

Inlining means that StyleBlocks and a DOM tree are combined:

a { color: red; } # StyleBlock
<a href="/"></a>  # DOM

becomes

<a href="/" style="color:red"></a>

Defined Under Namespace

Classes: StyleMap

Instance Method Summary (collapse)

Constructor Details

- (Inliner) initialize(stylesheets)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Inliner

Parameters:

  • stylesheets (Array<Stylesheet>)

    the stylesheets to use in the inlining



19
20
21
# File 'lib/roadie/inliner.rb', line 19

def initialize(stylesheets)
  @stylesheets = stylesheets
end

Instance Method Details

- (nil) inline(dom)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Start the inlining, mutating the DOM tree.

Parameters:

  • dom (Nokogiri::HTML::Document)

Returns:

  • (nil)


27
28
29
30
# File 'lib/roadie/inliner.rb', line 27

def inline(dom)
  apply style_map(dom)
  nil
end