Class: Awestruct::Handlers::BaseHandler
- Inherits:
-
Object
- Object
- Awestruct::Handlers::BaseHandler
show all
- Defined in:
- lib/awestruct/handlers/base_handler.rb
Direct Known Subclasses
BaseTiltHandler, FileHandler, FrontMatterHandler, InterpolationHandler, JavascriptHandler, LayoutHandler, NoOpHandler, PageDelegatingHandler, RedirectHandler, StringHandler, YamlHandler
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(site, delegate = nil) ⇒ BaseHandler
Returns a new instance of BaseHandler.
12
13
14
15
|
# File 'lib/awestruct/handlers/base_handler.rb', line 12
def initialize(site, delegate=nil)
@site = site
@delegate = delegate
end
|
Instance Attribute Details
#delegate ⇒ Object
Returns the value of attribute delegate.
10
11
12
|
# File 'lib/awestruct/handlers/base_handler.rb', line 10
def delegate
@delegate
end
|
#site ⇒ Object
Returns the value of attribute site.
9
10
11
|
# File 'lib/awestruct/handlers/base_handler.rb', line 9
def site
@site
end
|
Instance Method Details
#content_line_offset ⇒ Object
82
83
84
85
|
# File 'lib/awestruct/handlers/base_handler.rb', line 82
def content_line_offset
return @delegate.content_line_offset if @delegate
0
end
|
#content_syntax ⇒ Object
67
68
69
70
|
# File 'lib/awestruct/handlers/base_handler.rb', line 67
def content_syntax
return @delegate.content_syntax if @delegate
:none
end
|
#dependencies ⇒ Object
91
92
93
94
|
# File 'lib/awestruct/handlers/base_handler.rb', line 91
def dependencies
return @delegate.dependencies if @delegate
[]
end
|
#execute_shell(command, input = nil, escape = true) ⇒ Object
102
103
104
105
106
107
108
109
110
|
# 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 ⇒ Object
62
63
64
65
|
# File 'lib/awestruct/handlers/base_handler.rb', line 62
def front_matter
return @delegate.front_matter if @delegate
{}
end
|
#inherit_front_matter(page) ⇒ Object
87
88
89
|
# File 'lib/awestruct/handlers/base_handler.rb', line 87
def inherit_front_matter(page)
return @delegate.inherit_front_matter(page) if @delegate
end
|
22
23
24
25
|
# File 'lib/awestruct/handlers/base_handler.rb', line 22
def input_mtime(page)
return @delegate.input_mtime(page) if @delegate
0
end
|
#output_extension ⇒ Object
51
52
53
54
55
|
# 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 ⇒ Object
37
38
39
40
|
# File 'lib/awestruct/handlers/base_handler.rb', line 37
def output_filename
return @delegate.output_filename if @delegate
nil
end
|
#output_path ⇒ Object
42
43
44
45
46
47
48
49
|
# 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 ⇒ Object
57
58
59
60
|
# File 'lib/awestruct/handlers/base_handler.rb', line 57
def path
return @delegate.path if @delegate
nil
end
|
#raw_content ⇒ Object
72
73
74
75
|
# File 'lib/awestruct/handlers/base_handler.rb', line 72
def raw_content
return @delegate.raw_content if @delegate
nil
end
|
#relative_source_path ⇒ Object
32
33
34
35
|
# 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) ⇒ Object
77
78
79
80
|
# 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 ⇒ Object
27
28
29
30
|
# File 'lib/awestruct/handlers/base_handler.rb', line 27
def simple_name
return @delegate.simple_name if @delegate
nil
end
|
#stale? ⇒ Boolean
17
18
19
20
|
# File 'lib/awestruct/handlers/base_handler.rb', line 17
def stale?
return @delegate.stale? if @delegate
false
end
|
#to_chain ⇒ Object
96
97
98
99
100
|
# File 'lib/awestruct/handlers/base_handler.rb', line 96
def to_chain
chain = [ self ]
chain += @delegate.to_chain if @delegate
chain.flatten
end
|