Class: Awestruct::Handlers::NonInterpolatingTiltMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/awestruct/handlers/tilt_handler.rb

Constant Summary

EXT_REGEX =
/\.(haml|slim|erb|mustache|ms)$/

Instance Method Summary collapse

Instance Method Details

#match(path) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/awestruct/handlers/tilt_handler.rb', line 16

def match(path)
  if match = EXT_REGEX.match(path)
    if match[0] == '.slim' && !::Tilt.registered?('slim')
      require 'slim'
    end
    if ((match[0] == '.mustache' || match[0] == '.ms') && !::Tilt.registered?('mustache'))
      require 'awestruct/handlers/template/mustache'
      ::Tilt::register ::Tilt::MustacheTemplate, 'mustache', 'ms'
    end
    true
  else
    false
  end
end