Class: Vedeu::Renderers::HTML
- Includes:
- Options
- Defined in:
- lib/vedeu/renderers/html.rb
Overview
Renders a Buffers::Terminal as a HTML snippet; a table by default.
Instance Attribute Summary
Attributes included from Options
Instance Method Summary collapse
- #content ⇒ String private
- #html_body ⇒ String
- #valid? ⇒ Boolean private
Methods included from Options
#clear, #compression, #compression?, #default_template, #defaults, #end_row_tag, #end_tag, #filename, #initialize, #output, #output?, #render, #start_row_tag, #start_tag, #template, #timestamp, #timestamp?, #write, #write_file, #write_file?
Methods included from Common
#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?
Methods inherited from File
Instance Method Details
#content ⇒ String (private)
34 35 36 37 38 39 40 41 42 |
# File 'lib/vedeu/renderers/html.rb', line 34 def content if valid? Vedeu::Templating::Template.parse(self, template) else '' end end |
#html_body ⇒ String
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vedeu/renderers/html.rb', line 15 def html_body if valid? output.inject([]) do |acc, line| acc << "#{start_row_tag}\n" line.each do |char| acc << char.to_html() end acc << "#{end_row_tag}\n" end.join else '' end end |
#valid? ⇒ Boolean (private)
45 46 47 48 49 |
# File 'lib/vedeu/renderers/html.rb', line 45 def valid? return false if string?(output) || escape?(output) true end |