Class: Prawn::SVG::CSS::Stylesheets

Inherits:
Object
  • Object
show all
Defined in:
lib/prawn/svg/css/stylesheets.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(css_parser, root, media = :all, url_loader: nil, warnings: []) ⇒ Stylesheets

Returns a new instance of Stylesheets.



5
6
7
8
9
10
11
12
13
14
# File 'lib/prawn/svg/css/stylesheets.rb', line 5

def initialize(css_parser, root, media = :all, url_loader: nil, warnings: [])
  @css_parser = css_parser
  @root = root
  @media = media
  @warnings = warnings
  @font_face_rules = []

  @has_url_loader = !url_loader.nil?
  install_url_loader_on_css_parser(url_loader) if url_loader
end

Instance Attribute Details

#css_parserObject (readonly)

Returns the value of attribute css_parser.



3
4
5
# File 'lib/prawn/svg/css/stylesheets.rb', line 3

def css_parser
  @css_parser
end

#font_face_rulesObject (readonly)

Returns the value of attribute font_face_rules.



3
4
5
# File 'lib/prawn/svg/css/stylesheets.rb', line 3

def font_face_rules
  @font_face_rules
end

#mediaObject (readonly)

Returns the value of attribute media.



3
4
5
# File 'lib/prawn/svg/css/stylesheets.rb', line 3

def media
  @media
end

#rootObject (readonly)

Returns the value of attribute root.



3
4
5
# File 'lib/prawn/svg/css/stylesheets.rb', line 3

def root
  @root
end

Instance Method Details

#loadObject



16
17
18
19
20
# File 'lib/prawn/svg/css/stylesheets.rb', line 16

def load
  load_style_elements
  xpath_styles = gather_xpath_styles
  associate_xpath_styles_with_elements(xpath_styles)
end