class Awestruct::Handlers::BaseHandler

Attributes

delegate[R]
site[R]

Public Class Methods

new(site, delegate=nil) click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 12
def initialize(site, delegate=nil)
  @site     = site
  @delegate = delegate
end

Public Instance Methods

content_line_offset() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 82
def content_line_offset
  return @delegate.content_line_offset if @delegate
  0
end
content_syntax() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 67
def content_syntax
  return @delegate.content_syntax if @delegate
  :none
end
dependencies() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 91
def dependencies
  return @delegate.dependencies if @delegate
  []
end
execute_shell(command, input=nil, escape=true) click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 102
def execute_shell(command, input=nil, escape=true)
  Open3.popen3(escape ? Shellwords.escape( command ) : command) do |stdin, stdout, _|
    stdin.puts input unless input.nil?
    stdin.close
    out = stdout.read
  end
rescue Errno::EPIPE
  ""
end
front_matter() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 62
def front_matter
  return @delegate.front_matter if @delegate
  {}
end
inherit_front_matter(page) click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 87
def inherit_front_matter(page)
  return @delegate.inherit_front_matter(page) if @delegate
end
input_mtime(page) click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 22
def input_mtime(page)
  return @delegate.input_mtime(page) if @delegate
  0
end
output_extension() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 51
def output_extension
  return @delegate.output_extension if @delegate 
  return File.extname( output_filename ) unless output_filename.nil?
  nil
end
output_filename() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 37
def output_filename
  return @delegate.output_filename if @delegate
  nil
end
output_path() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 42
def output_path
  return @output_path unless @output_path.nil?

  ( p = relative_source_path ) if relative_source_path
  ( of = output_filename ) if output_filename
  @output_path = File.join( File.dirname( p ), output_filename ) if ( p && of )
  @output_path || nil
end
path() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 57
def path
  return @delegate.path if @delegate
  nil
end
raw_content() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 72
def raw_content
  return @delegate.raw_content if @delegate
  nil
end
relative_source_path() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 32
def relative_source_path 
  return @delegate.relative_source_path if @delegate
  nil
end
rendered_content(context, with_layouts=true) click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 77
def rendered_content(context, with_layouts=true)
  return @delegate.rendered_content(context, with_layouts) if @delegate
  nil
end
simple_name() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 27
def simple_name
  return @delegate.simple_name if @delegate
  nil
end
stale?() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 17
def stale?
  return @delegate.stale? if @delegate
  false
end
to_chain() click to toggle source
# File lib/awestruct/handlers/base_handler.rb, line 96
def to_chain
  chain = [ self ]
  chain += @delegate.to_chain if @delegate
  chain.flatten
end