class Awestruct::Handlers::RedirectHandler

Constants

CHAIN

Public Class Methods

new(site, delegate) click to toggle source
Calls superclass method Awestruct::Handlers::BaseHandler::new
# File lib/awestruct/handlers/redirect_handler.rb, line 19
def initialize(site, delegate)
  super( site, delegate )
end

Public Instance Methods

content_syntax() click to toggle source
# File lib/awestruct/handlers/redirect_handler.rb, line 35
def content_syntax
  :text
end
output_extension() click to toggle source
# File lib/awestruct/handlers/redirect_handler.rb, line 31
def output_extension
  '.html'
end
output_filename() click to toggle source
# File lib/awestruct/handlers/redirect_handler.rb, line 27
def output_filename
  simple_name + output_extension
end
rendered_content(context, with_layouts=false) click to toggle source
# File lib/awestruct/handlers/redirect_handler.rb, line 39
def rendered_content(context, with_layouts=false)
  url = delegate.rendered_content( context, with_layouts ).strip
  # should we auto-qualify the URL?
  # they can use #{site.base_url}/path currently
  #if url.start_with? '/'
  #  url = File.join(@site.base_url, url)
  #end
  %{<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0;url=#{url}"></head></html>}
end
simple_name() click to toggle source
# File lib/awestruct/handlers/redirect_handler.rb, line 23
def simple_name
  File.basename( relative_source_path || path, '.redirect' ) 
end