Class: Gotenberg::Analyzers::Css

Inherits:
Base
  • Object
show all
Defined in:
lib/gotenberg/analyzers/css.rb

Constant Summary collapse

ASSETS_REGEX =
/url\((?!['"]?(?:data|https?):)['"]?([^'"\)]*)['"]?\)/

Constants inherited from Base

Base::URI_REGEXP

Instance Attribute Summary

Attributes inherited from Base

#resource

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Gotenberg::Analyzers::Base

Instance Method Details

#assetsObject



23
24
25
# File 'lib/gotenberg/analyzers/css.rb', line 23

def assets
  @assets ||= [[binary, filename]]
end

#callObject



9
10
11
12
13
# File 'lib/gotenberg/analyzers/css.rb', line 9

def call
  analyze_binary unless resource[:skip_analyze]

  self
end

#tagObject



15
16
17
18
19
20
21
# File 'lib/gotenberg/analyzers/css.rb', line 15

def tag
  if resource[:inline]
    '<style type="text/css">%s</style>' % binary
  else
    '<link rel="stylesheet" href="%s" />' % filename
  end
end