Class: Shiba::Review::CommentRenderer
- Inherits:
-
Object
- Object
- Shiba::Review::CommentRenderer
- Defined in:
- lib/shiba/review/comment_renderer.rb
Constant Summary collapse
- VAR_PATTERN =
variable }
/{{\s?([a-z_]+)\s?}}/
Instance Method Summary collapse
-
#initialize(templates) ⇒ CommentRenderer
constructor
A new instance of CommentRenderer.
- #render(explain) ⇒ Object
Constructor Details
#initialize(templates) ⇒ CommentRenderer
Returns a new instance of CommentRenderer.
9 10 11 |
# File 'lib/shiba/review/comment_renderer.rb', line 9 def initialize(templates) @templates = templates end |
Instance Method Details
#render(explain) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/shiba/review/comment_renderer.rb', line 13 def render(explain) body = "" explain["messages"].each do || tag = ['tag'] data = present() data.merge!(explain["global"]) body << " * " body << @templates[tag]["title"] body << ": " body << render_template(@templates[tag]["summary"], data) body << "\n" end body << " * Estimated query time: %.2fs" % explain['cost'] body end |