Class: Jekyll::Engine::Base
- Inherits:
-
Object
- Object
- Jekyll::Engine::Base
- Defined in:
- lib/jekyll/rendering.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Class Method Summary collapse
-
.render(payload, content, info, data = {}, layout = nil) ⇒ Object
call-seq: Engine::Base.render(*args).
Instance Method Summary collapse
-
#initialize(payload, content = nil, info = {}, data = {}) ⇒ Base
constructor
A new instance of Base.
-
#render ⇒ Object
call-seq: render.
- #render_error(err, renderer = nil, trace = Rendering::ERROR_TRACE) ⇒ Object
Constructor Details
#initialize(payload, content = nil, info = {}, data = {}) ⇒ Base
Returns a new instance of Base.
109 110 111 |
# File 'lib/jekyll/rendering.rb', line 109 def initialize(payload, content = nil, info = {}, data = {}) @payload, @content, @info, @data = payload, content, info, data end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
107 108 109 |
# File 'lib/jekyll/rendering.rb', line 107 def content @content end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
106 107 108 |
# File 'lib/jekyll/rendering.rb', line 106 def data @data end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
106 107 108 |
# File 'lib/jekyll/rendering.rb', line 106 def info @info end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
106 107 108 |
# File 'lib/jekyll/rendering.rb', line 106 def payload @payload end |
Class Method Details
.render(payload, content, info, data = {}, layout = nil) ⇒ Object
call-seq:
Engine::Base.render(*args)
Renders the output. Defers to engine’s render method.
102 103 104 |
# File 'lib/jekyll/rendering.rb', line 102 def self.render(payload, content, info, data = {}, layout = nil) new(payload, content, info, data).render(layout || content) end |
Instance Method Details
#render ⇒ Object
call-seq:
render
Renders the output. Must be implemented by subclass.
117 118 119 |
# File 'lib/jekyll/rendering.rb', line 117 def render raise NotImplementedError end |
#render_error(err, renderer = nil, trace = Rendering::ERROR_TRACE) ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/jekyll/rendering.rb', line 121 def render_error(err, renderer = nil, trace = Rendering::ERROR_TRACE) msg = [self.class.name.split('::').last] msg << "[#{renderer}]" if renderer msg << 'Exception:' << err msg << "(in #{data['layout'] || '(top)'})" msg << "(from #{err.backtrace[0, trace].join(', ')})" if trace > 0 msg.join(' ') end |