Class: Vedeu::Renderers::HTML Private

Inherits:
File
  • Object
show all
Includes:
Options
Defined in:
lib/vedeu/renderers/html.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Renders a Buffers::Terminal as a HTML snippet; a table by default.

Instance Attribute Summary

Attributes included from Options

#options

Instance Method Summary collapse

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

#write, #write_file?

Instance Method Details

#contentString (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


36
37
38
39
40
41
42
43
44
# File 'lib/vedeu/renderers/html.rb', line 36

def content
  if valid?
    Vedeu::Templating::Template.parse(self, template)

  else
    ''

  end
end

#html_bodyString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/vedeu/renderers/html.rb', line 17

def html_body
  if valid?
    output.inject([]) do |acc, line|
      acc << "#{start_row_tag}\n"
      line.each do |char|
        acc << char.to_html(options)
      end
      acc << "#{end_row_tag}\n"
    end.join

  else
    ''

  end
end

#valid?Boolean (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



47
48
49
50
51
# File 'lib/vedeu/renderers/html.rb', line 47

def valid?
  return false if string?(output) || escape?(output)

  true
end