Class: Emcee::PostProcessors::StylesheetProcessor
- Inherits:
-
Object
- Object
- Emcee::PostProcessors::StylesheetProcessor
- Defined in:
- lib/emcee/post_processors/stylesheet_processor.rb
Overview
StylesheetProcessor scans a document for external stylesheet references and inlines them into the current document.
Instance Method Summary collapse
-
#initialize(context) ⇒ StylesheetProcessor
constructor
A new instance of StylesheetProcessor.
- #process(data) ⇒ Object
Constructor Details
#initialize(context) ⇒ StylesheetProcessor
Returns a new instance of StylesheetProcessor.
9 10 11 12 |
# File 'lib/emcee/post_processors/stylesheet_processor.rb', line 9 def initialize(context) @context = context @directory = File.dirname(context.pathname) end |
Instance Method Details
#process(data) ⇒ Object
14 15 16 17 18 |
# File 'lib/emcee/post_processors/stylesheet_processor.rb', line 14 def process(data) doc = Nokogiri::HTML.fragment(data) inline_styles(doc) URI.unescape(doc.to_s) end |