Class: Frozen::Template::View
- Inherits:
-
Base
- Object
- Base
- Frozen::Template::View
show all
- Defined in:
- lib/frozen/template/view.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#file_path, #template_root_path
Instance Method Summary
collapse
Methods inherited from Base
#build_file_path, #build_filename, #file_type, #read_from_file, #relative_path, #relative_to_root, #render_to_file, #template_filename, #template_path
Constructor Details
#initialize(options = {}) ⇒ View
Returns a new instance of View.
11
12
|
# File 'lib/frozen/template/view.rb', line 11
def initialize(options={})
end
|
Instance Attribute Details
#layout_path ⇒ Object
Returns the value of attribute layout_path.
9
10
11
|
# File 'lib/frozen/template/view.rb', line 9
def layout_path
@layout_path
end
|
#options ⇒ Object
Returns the value of attribute options.
8
9
10
|
# File 'lib/frozen/template/view.rb', line 8
def options
@options
end
|
Instance Method Details
#build_extension ⇒ Object
18
19
20
|
# File 'lib/frozen/template/view.rb', line 18
def build_extension
".html"
end
|
#build_path ⇒ Object
22
23
24
|
# File 'lib/frozen/template/view.rb', line 22
def build_path
""
end
|
#contents ⇒ Object
14
15
16
|
# File 'lib/frozen/template/view.rb', line 14
def contents
read_from_file(file_path)
end
|
#get_layout_path ⇒ Object
31
32
33
|
# File 'lib/frozen/template/view.rb', line 31
def get_layout_path
File.join(layout_path, "default.html.slim")
end
|
#layout ⇒ Object
35
36
37
|
# File 'lib/frozen/template/view.rb', line 35
def layout
Slim::Template.new {File.read(get_layout_path)}
end
|
#render ⇒ Object
26
27
28
29
|
# File 'lib/frozen/template/view.rb', line 26
def render
env = Frozen::Environment::Base.new(self)
layout.render(env) { Slim::Template.new { contents }.render(env) }
end
|