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 collapse
- #options ⇒ Hash<Symbol => void> included from Options
Instance Method Summary collapse
-
#absent?(variable) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether a variable is nil or empty.
-
#become(klass, attributes) ⇒ Class
included
from Common
private
Converts one class into another.
-
#boolean(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating the value was a boolean.
-
#boolean?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Boolean.
- #clear ⇒ void included from Options
-
#compression ⇒ String
included
from Options
private
Compresses the output depending on configuration.
-
#compression? ⇒ Boolean
included
from Options
private
Returns a boolean indicating whether the content should be compressed if compression is available.
- #content ⇒ String private
- #default_template ⇒ String included from Options private
-
#defaults ⇒ Hash<Symbol => void>
included
from Options
private
The default values for a new instance of this class.
- #end_row_tag ⇒ String included from Options private
- #end_tag ⇒ String included from Options private
-
#escape?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is an escape sequence object (e.g. Cells::Escape.).
-
#falsy?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value should be considered false.
-
#filename ⇒ String
included
from Options
private
Return the filename given in the options, (or use the default), and append a timestamp if the :timestamp option was set to true.
-
#hash?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Hash.
- #html_body ⇒ String
-
#initialize(opts = {}) ⇒ void
included
from Options
Returns a new instance of the class including this module.
-
#line_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::Line.
-
#numeric?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Fixnum.
- #output ⇒ void included from Options private
- #output? ⇒ Boolean included from Options private
-
#present?(variable) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether a variable has a useful value.
- #render(output = '') ⇒ void included from Options
-
#snake_case(klass) ⇒ String
included
from Common
private
Converts a class name to a lowercase snake case string.
- #start_row_tag ⇒ String included from Options private
- #start_tag ⇒ String included from Options private
-
#stream_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::Stream.
-
#string?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Fixnum.
- #template ⇒ String included from Options private
-
#timestamp ⇒ String
included
from Options
private
Return a timestamp for use as part of the filename if the :timestamp option was set to true, otherwise an empty string.
- #timestamp? ⇒ Boolean included from Options private
-
#truthy?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value should be considered true.
- #valid? ⇒ Boolean private
-
#view_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::View.
- #write ⇒ Object included from Options
-
#write_file ⇒ String
included
from Options
private
Render the output (either content or clearing) to a file.
-
#write_file? ⇒ Boolean
included
from Options
private
Returns a boolean indicating whether a file should be written.
Instance Attribute Details
#options ⇒ Hash<Symbol => void> Originally defined in module Options
Instance Method Details
#absent?(variable) ⇒ Boolean Originally defined in module Common
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 a boolean indicating whether a variable is nil or empty.
#become(klass, attributes) ⇒ Class Originally defined in module Common
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.
Converts one class into another.
#boolean(value) ⇒ Boolean Originally defined in module Common
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 a boolean indicating the value was a boolean.
#boolean?(value) ⇒ Boolean Originally defined in module Common
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 a boolean indicating whether the value is a Boolean.
#clear ⇒ void Originally defined in module Options
This method returns an undefined value.
#compression ⇒ String (private) Originally defined in module Options
Compresses the output depending on configuration.
#compression? ⇒ Boolean (private) Originally defined in module Options
Returns a boolean indicating whether the content should be compressed if compression is available.
#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 |
#default_template ⇒ String (private) Originally defined in module Options
#defaults ⇒ Hash<Symbol => void> (private) Originally defined in module Options
The default values for a new instance of this class.
#end_row_tag ⇒ String (private) Originally defined in module Options
#end_tag ⇒ String (private) Originally defined in module Options
#escape?(value) ⇒ Boolean Originally defined in module Common
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 a boolean indicating whether the value is an escape sequence object (e.g. Vedeu::Cells::Escape.)
#falsy?(value) ⇒ Boolean Originally defined in module Common
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 a boolean indicating whether the value should be considered false.
#filename ⇒ String (private) Originally defined in module Options
Return the filename given in the options, (or use the default), and append a timestamp if the :timestamp option was set to true.
#hash?(value) ⇒ Boolean Originally defined in module Common
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 a boolean indicating whether the value is a Hash.
#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 |
#initialize(opts = {}) ⇒ void Originally defined in module Options
Returns a new instance of the class including this module.
#line_model? ⇒ Boolean Originally defined in module Common
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 a boolean indicating the model is a Views::Line.
#numeric?(value) ⇒ Boolean Originally defined in module Common
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 a boolean indicating whether the value is a Fixnum.
#output ⇒ void (private) Originally defined in module Options
This method returns an undefined value.
#present?(variable) ⇒ Boolean Originally defined in module Common
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 a boolean indicating whether a variable has a useful value.
#render(output = '') ⇒ void Originally defined in module Options
This method returns an undefined value.
#snake_case(klass) ⇒ String Originally defined in module Common
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.
Converts a class name to a lowercase snake case string.
#start_row_tag ⇒ String (private) Originally defined in module Options
#start_tag ⇒ String (private) Originally defined in module Options
#stream_model? ⇒ Boolean Originally defined in module Common
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 a boolean indicating the model is a Views::Stream.
#string?(value) ⇒ Boolean Originally defined in module Common
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 a boolean indicating whether the value is a Fixnum.
#template ⇒ String (private) Originally defined in module Options
#timestamp ⇒ String (private) Originally defined in module Options
Return a timestamp for use as part of the filename if the :timestamp option was set to true, otherwise an empty string.
#truthy?(value) ⇒ Boolean Originally defined in module Common
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 a boolean indicating whether the value should be considered true.
#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 |
#view_model? ⇒ Boolean Originally defined in module Common
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 a boolean indicating the model is a Views::View.
#write ⇒ Object Originally defined in module Options
#write_file ⇒ String (private) Originally defined in module Options
Render the output (either content or clearing) to a file.