Class: Awestruct::Handlers::BaseHandler

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site, delegate = nil) ⇒ BaseHandler

Returns a new instance of BaseHandler.



11
12
13
14
# File 'lib/awestruct/handlers/base_handler.rb', line 11

def initialize(site, delegate=nil)
  @site     = site
  @delegate = delegate
end

Instance Attribute Details

#delegateObject (readonly)

Returns the value of attribute delegate.



9
10
11
# File 'lib/awestruct/handlers/base_handler.rb', line 9

def delegate
  @delegate
end

#siteObject (readonly)

Returns the value of attribute site.



8
9
10
# File 'lib/awestruct/handlers/base_handler.rb', line 8

def site
  @site
end

Instance Method Details

#content_line_offsetObject



79
80
81
82
# File 'lib/awestruct/handlers/base_handler.rb', line 79

def content_line_offset
  return @delegate.content_line_offset if @delegate
  0
end

#content_syntaxObject



64
65
66
67
# File 'lib/awestruct/handlers/base_handler.rb', line 64

def content_syntax
  return @delegate.raw_content if @delegate
  :none
end

#front_matterObject



59
60
61
62
# File 'lib/awestruct/handlers/base_handler.rb', line 59

def front_matter
  return @delegate.front_matter if @delegate
  {}
end

#inherit_front_matter(page) ⇒ Object



84
85
86
# File 'lib/awestruct/handlers/base_handler.rb', line 84

def inherit_front_matter(page)
  @delegate.inherit_front_matter(page) if @delegate
end

#input_mtime(page) ⇒ Object



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

def input_mtime(page)
  return @delegate.input_mtime(page) if @delegate
  0
end

#output_extensionObject



48
49
50
51
52
# File 'lib/awestruct/handlers/base_handler.rb', line 48

def output_extension
  return @delegate.output_extension if @delegate 
  return File.extname( output_filename ) unless output_filename.nil?
  nil
end

#output_filenameObject



36
37
38
39
# File 'lib/awestruct/handlers/base_handler.rb', line 36

def output_filename
  return @delegate.output_filename if @delegate
  nil
end

#output_pathObject



41
42
43
44
45
46
# File 'lib/awestruct/handlers/base_handler.rb', line 41

def output_path
  ( p = relative_source_path ) if relative_source_path
  ( of = output_filename ) if output_filename
  return File.join( File.dirname( p ), output_filename ) if ( p && of )
  nil
end

#pathObject



54
55
56
57
# File 'lib/awestruct/handlers/base_handler.rb', line 54

def path
  return @delegate.path if @delegate
  nil
end

#raw_contentObject



69
70
71
72
# File 'lib/awestruct/handlers/base_handler.rb', line 69

def raw_content
  return @delegate.raw_content if @delegate
  nil
end

#relative_source_pathObject



31
32
33
34
# File 'lib/awestruct/handlers/base_handler.rb', line 31

def relative_source_path 
  return @delegate.relative_source_path if @delegate
  nil
end

#rendered_content(context, with_layouts = true) ⇒ Object



74
75
76
77
# File 'lib/awestruct/handlers/base_handler.rb', line 74

def rendered_content(context, with_layouts=true)
  return @delegate.rendered_content(context, with_layouts) if @delegate
  nil
end

#simple_nameObject



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

def simple_name
  return @delegate.simple_name if @delegate
  nil
end

#stale?Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/awestruct/handlers/base_handler.rb', line 16

def stale?
  return @delegate.stale? if @delegate
  false
end

#to_chainObject



88
89
90
91
92
# File 'lib/awestruct/handlers/base_handler.rb', line 88

def to_chain
  chain = [ self ]
  chain += @delegate.to_chain if @delegate
  chain.flatten
end