Class: Serve::DynamicHandler

Inherits:
FileTypeHandler show all
Defined in:
lib/serve/handlers/dynamic_handler.rb

Overview

:nodoc:

Defined Under Namespace

Classes: Parser

Instance Attribute Summary

Attributes inherited from FileTypeHandler

#extension

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FileTypeHandler

configure, #content_type, extension, extension_options, handlers, handlers_for, #initialize, #layout?, options_for, #process

Constructor Details

This class inherits a constructor from Serve::FileTypeHandler

Class Method Details

.extensionsObject



6
7
8
9
10
# File 'lib/serve/handlers/dynamic_handler.rb', line 6

def self.extensions
  # Get extensions from Tilt, ugly but it works
  #FIXME: Excluded HTML from Tilt's mappings to make the tests pass!
  @extensions ||= (Tilt.mappings.map { |k,v| ["#{k}", "html.#{k}"] if k != "html" } << ["slim", "html.slim"]).flatten
end

Instance Method Details

#extensionsObject



12
13
14
# File 'lib/serve/handlers/dynamic_handler.rb', line 12

def extensions
  self.class.extensions
end

#parse(input, context) ⇒ Object



18
19
20
21
# File 'lib/serve/handlers/dynamic_handler.rb', line 18

def parse(input, context)
  parser = Parser.new(context, @template_path)
  parser.parse(input, extension)
end