Class: Transformer
- Inherits:
-
Object
- Object
- Transformer
- Includes:
- Singleton
- Defined in:
- lib/roger_autoprefixer/transformer.rb
Overview
The transformer will take care of thread safe transformation of css without vendor prefixes -> css with vendor prefixes using autoprefixer. We need this to prevent deadlock in the V8 engine.
Instance Method Summary collapse
-
#initialize ⇒ Transformer
constructor
A new instance of Transformer.
- #transform(code, options) ⇒ Object
Constructor Details
#initialize ⇒ Transformer
Returns a new instance of Transformer.
14 15 16 |
# File 'lib/roger_autoprefixer/transformer.rb', line 14 def initialize @mutex = Mutex.new end |
Instance Method Details
#transform(code, options) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/roger_autoprefixer/transformer.rb', line 18 def transform(code, ) prefixer = nil @mutex.synchronize do prefixer = AutoprefixerRails.process(code, ) end prefixer.css end |