Class: Vedeu::Renderers::Terminal

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

Overview

Converts a grid of Cells::Char objects into a stream of escape sequences and content suitable for a terminal.

Instance Attribute Summary

Attributes included from Options

#options

Instance Method Summary collapse

Methods included from Options

#compression, #compression?, #default_template, #defaults, #end_row_tag, #end_tag, #filename, #initialize, #output, #output?, #render, #start_row_tag, #start_tag, #template, #timestamp, #timestamp?, #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?

Instance Method Details

#clearString

Render a cleared output.

Returns:

  • (String)


17
18
19
20
21
# File 'lib/vedeu/renderers/terminal.rb', line 17

def clear
  Vedeu::Terminal.clear

  render('')
end

#contentString (private)

Returns the output in a compressed form if the :compression option is true.

Returns:

  • (String)


36
37
38
# File 'lib/vedeu/renderers/terminal.rb', line 36

def content
  compression
end

#writable_dataString (private)

Returns:

  • (String)


41
42
43
44
45
# File 'lib/vedeu/renderers/terminal.rb', line 41

def writable_data
  return write_file if write_file?

  content
end

#writeString

Render the output (either content or clearing) to the console.

Returns:

  • (String)


26
27
28
# File 'lib/vedeu/renderers/terminal.rb', line 26

def write
  Vedeu.direct_write(writable_data)
end