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



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

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

#content_syntaxObject



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

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

#front_matterObject



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

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

#inherit_front_matter(page) ⇒ Object



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

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



45
46
47
48
# File 'lib/awestruct/handlers/base_handler.rb', line 45

def output_extension
  return @delegate.output_extension if @delegate
  File.extname( output_filename )
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
# File 'lib/awestruct/handlers/base_handler.rb', line 41

def output_path
  File.join( File.dirname( relative_source_path ), output_filename )
end

#pathObject



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

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

#raw_contentObject



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

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



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

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



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

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