Class: CssMedia::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/css_media/processor.rb

Instance Method Summary collapse

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:

  • from with input CSS file name. Will be used in error messages.

  • to with output CSS file name.

  • map with 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