Class: Emcee::StylesheetProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/emcee/processors/stylesheet_processor.rb

Overview

StylesheetProcessor scans a document for external stylesheet references and inlines them into the current document.

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ StylesheetProcessor

Returns a new instance of StylesheetProcessor.



7
8
9
10
# File 'lib/emcee/processors/stylesheet_processor.rb', line 7

def initialize(context)
  @context = context
  @directory = File.dirname(context.pathname)
end

Instance Method Details

#process(data) ⇒ Object



12
13
14
15
16
# File 'lib/emcee/processors/stylesheet_processor.rb', line 12

def process(data)
  doc = Nokogiri::HTML.fragment(data)
  inline_styles(doc)
  doc.to_s
end