Class: Awestruct::RenderableFile
- Inherits:
-
Renderable
- Object
- OpenStruct
- Renderable
- Awestruct::RenderableFile
show all
- Defined in:
- lib/awestruct/renderable_file.rb
Instance Attribute Summary
Attributes inherited from Renderable
#site
Instance Method Summary
(collapse)
Constructor Details
- (RenderableFile) initialize(site, source_path, relative_source_path, options = {})
A new instance of RenderableFile
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/awestruct/renderable_file.rb', line 7
def initialize(site, source_path, relative_source_path, options = {})
super( site )
self.source_path = source_path
self.relative_source_path = relative_source_path
self.options = options
unless ( relative_source_path.nil? )
dir_name = File.dirname( relative_source_path )
if ( dir_name == '.' )
self.output_path = output_filename
else
self.output_path = File.join( dir_name, output_filename )
end
end
end
|
Instance Method Details
- (Object) output_extension
30
31
32
|
# File 'lib/awestruct/renderable_file.rb', line 30
def output_extension
File.extname( self.source_path )
end
|
- (Object) output_filename
34
35
36
|
# File 'lib/awestruct/renderable_file.rb', line 34
def output_filename
File.basename( self.source_path )
end
|
- (Object) raw_page_content
22
23
24
|
# File 'lib/awestruct/renderable_file.rb', line 22
def raw_page_content
File.read( self.source_path ).tap {|f| f.force_encoding(@site.encoding) if @site.encoding }
end
|
- (Object) render(context)
26
27
28
|
# File 'lib/awestruct/renderable_file.rb', line 26
def render(context)
raw_page_content
end
|