Class: CssMedia::Processor
- Inherits:
-
Object
- Object
- CssMedia::Processor
- Defined in:
- lib/css_media/processor.rb
Instance Method Summary collapse
-
#initialize(params = { }) ⇒ Processor
constructor
A new instance of Processor.
-
#process(css, opts = { }) ⇒ Object
Process
cssand return result.
Constructor Details
#initialize(params = { }) ⇒ Processor
Returns a new instance of Processor.
6 7 8 |
# File 'lib/css_media/processor.rb', line 6 def initialize(params = { }) @params = params || { } end |
Instance Method Details
#process(css, opts = { }) ⇒ Object
Process css and return result.
Options can be:
-
fromwith input CSS file name. Will be used in error messages. -
towith output CSS file name. -
mapwith true to generate new source map or with previous map.
16 17 18 19 20 21 22 |
# File 'lib/css_media/processor.rb', line 16 def process(css, opts = { }) fn = opts.fetch(:from, '').downcase.gsub('-', '_') if fn =~ /[^a-z](media_only|non?_media)[^a-z]/ css = send($1, css) end Result.new(css) end |