Class: Awestruct::Handlers::CoffeescriptHandler

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

Constant Summary collapse

CHAIN =
Awestruct::HandlerChain.new( /\.coffee$/,
  Awestruct::Handlers::FileHandler,
  Awestruct::Handlers::FrontMatterHandler,
  Awestruct::Handlers::InterpolationHandler,
  Awestruct::Handlers::CoffeescriptHandler
)

Instance Attribute Summary

Attributes inherited from BaseHandler

#delegate, #site

Instance Method Summary collapse

Methods inherited from BaseHandler

#content_line_offset, #dependencies, #execute_shell, #front_matter, #inherit_front_matter, #input_mtime, #output_path, #path, #raw_content, #relative_source_path, #stale?, #to_chain

Constructor Details

#initialize(site, delegate) ⇒ CoffeescriptHandler

Returns a new instance of CoffeescriptHandler.



22
23
24
# File 'lib/awestruct/handlers/coffeescript_handler.rb', line 22

def initialize(site, delegate)
  super( site, delegate )
end

Instance Method Details

#content_syntaxObject



38
39
40
# File 'lib/awestruct/handlers/coffeescript_handler.rb', line 38

def content_syntax
  :coffeescript
end

#output_extensionObject



34
35
36
# File 'lib/awestruct/handlers/coffeescript_handler.rb', line 34

def output_extension
  '.js'
end

#output_filenameObject



30
31
32
# File 'lib/awestruct/handlers/coffeescript_handler.rb', line 30

def output_filename
  File.basename( relative_source_path, '.coffee' ) + '.js'
end

#rendered_content(context, with_layouts = true) ⇒ Object



42
43
44
# File 'lib/awestruct/handlers/coffeescript_handler.rb', line 42

def rendered_content(context, with_layouts=true)
  CoffeeScript.compile( delegate.rendered_content( context, with_layouts ) )
end

#simple_nameObject



26
27
28
# File 'lib/awestruct/handlers/coffeescript_handler.rb', line 26

def simple_name
  File.basename( relative_source_path, '.coffee' ) 
end