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, RestructuredtextHandler, 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
80
81
82
83
|
# File 'lib/awestruct/handlers/base_handler.rb', line 80
def content_line_offset
return @delegate.content_line_offset if @delegate
0
end
|
#content_syntax ⇒ Object
65
66
67
68
|
# File 'lib/awestruct/handlers/base_handler.rb', line 65
def content_syntax
return @delegate.content_syntax if @delegate
:none
end
|
#dependencies ⇒ Object
89
90
91
92
|
# File 'lib/awestruct/handlers/base_handler.rb', line 89
def dependencies
return @delegate.dependencies if @delegate
[]
end
|
#execute_shell(command, input = nil, escape = true) ⇒ Object
100
101
102
103
104
105
106
107
108
|
# File 'lib/awestruct/handlers/base_handler.rb', line 100
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
60
61
62
63
|
# File 'lib/awestruct/handlers/base_handler.rb', line 60
def front_matter
return @delegate.front_matter if @delegate
{}
end
|
#inherit_front_matter(page) ⇒ Object
85
86
87
|
# File 'lib/awestruct/handlers/base_handler.rb', line 85
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
49
50
51
52
53
|
# File 'lib/awestruct/handlers/base_handler.rb', line 49
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
|
# File 'lib/awestruct/handlers/base_handler.rb', line 42
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
|
#path ⇒ Object
55
56
57
58
|
# File 'lib/awestruct/handlers/base_handler.rb', line 55
def path
return @delegate.path if @delegate
nil
end
|
#raw_content ⇒ Object
70
71
72
73
|
# File 'lib/awestruct/handlers/base_handler.rb', line 70
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
75
76
77
78
|
# File 'lib/awestruct/handlers/base_handler.rb', line 75
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
94
95
96
97
98
|
# File 'lib/awestruct/handlers/base_handler.rb', line 94
def to_chain
chain = [ self ]
chain += @delegate.to_chain if @delegate
chain.flatten
end
|