Class: Slim::Embedded::TiltEngine

Inherits:
Object
  • Object
show all
Defined in:
lib/brakeman/parsers/slim_embedded.rb

Direct Known Subclasses

CoffeeEngine

Instance Method Summary collapse

Instance Method Details

#on_slim_embedded(engine, body, attrs) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/brakeman/parsers/slim_embedded.rb', line 5

def on_slim_embedded(engine, body, attrs)
  # Override this method to avoid Slim trying to load sass/scss and failing
  case engine
  when :sass, :scss, :coffee
    tilt_engine = nil # Doesn't really matter, ignored below
  else
    # Original Slim code
    tilt_engine = Tilt[engine] || raise(Temple::FilterError, "Tilt engine #{engine} is not available.")
  end

  tilt_options = options[engine.to_sym] || {}
  tilt_options[:default_encoding] ||= 'utf-8'

  [:multi, tilt_render(tilt_engine, tilt_options, collect_text(body)), collect_newlines(body)]
end