Class: Mako::HTMLRenderer
- Inherits:
-
Object
- Object
- Mako::HTMLRenderer
- Includes:
- FileOpenUtil
- Defined in:
- lib/mako/html_renderer.rb
Instance Attribute Summary collapse
-
#bound ⇒ Object
readonly
Returns the value of attribute bound.
-
#feed_template ⇒ Object
readonly
Returns the value of attribute feed_template.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
-
#file_path ⇒ String
Default file name for rendererd file.
-
#initialize(args) ⇒ HTMLRenderer
constructor
A new instance of HTMLRenderer.
-
#render ⇒ String
Wrapper for ERB renderer.
Methods included from FileOpenUtil
Constructor Details
#initialize(args) ⇒ HTMLRenderer
Returns a new instance of HTMLRenderer.
9 10 11 12 13 |
# File 'lib/mako/html_renderer.rb', line 9 def initialize(args) @template = args.fetch(:template, File.(File.join('themes', "#{Mako.config.theme}.html.erb"), Dir.pwd)) @bound = args.fetch(:bound) @feed_template = File.('layouts/_feed_container.html.erb', __dir__) end |
Instance Attribute Details
#bound ⇒ Object (readonly)
Returns the value of attribute bound.
7 8 9 |
# File 'lib/mako/html_renderer.rb', line 7 def bound @bound end |
#feed_template ⇒ Object (readonly)
Returns the value of attribute feed_template.
7 8 9 |
# File 'lib/mako/html_renderer.rb', line 7 def feed_template @feed_template end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
7 8 9 |
# File 'lib/mako/html_renderer.rb', line 7 def template @template end |
Instance Method Details
#file_path ⇒ String
Default file name for rendererd file.
26 27 28 |
# File 'lib/mako/html_renderer.rb', line 26 def file_path 'index.html' end |
#render ⇒ String
Wrapper for ERB renderer. Creates new ERB instance with view template and renders it with binding from core.
19 20 21 |
# File 'lib/mako/html_renderer.rb', line 19 def render ERB.new(load_resource(template)).result(bound.get_binding) end |