Class: Vedeu::Cells::Escape Private

Inherits:
Empty
  • Object
show all
Defined in:
lib/vedeu/cells/escape.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.

Provides the character/escape sequence to draw one cell of a with a custom value, colour and style.

The Vedeu::Cells::Escape object represents an escape sequence as a single character, meaning they will behave dependent on the context in which they are used.

(In a terminal, an escape sequence makes sense, when a view is being rendered as HTML, the sequence may be meaningless, for example; the sequence to show or hide the cursor.)

Instance Attribute Summary

Attributes inherited from Empty

#name, #value

Instance Method Summary collapse

Methods inherited from Empty

#as_html, #border, #defaults, #eql?, #geometry, #interface, #to_ast, #value?

Methods included from Repositories::Defaults

#defaults, #initialize, #validate

Methods included from Vedeu::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 included from Presentation::Styles

#render_style, #style=, #style?

Methods included from Presentation::Parent

#name, #parent, #parent?

Methods included from Presentation::Position

#position, #position=, #position?, #render_position, #x, #y

Methods included from Presentation::Colour

#background=, #colour=, #colour?, #foreground=, #interface, #named_colour, #named_colour?, #parent_colour, #parent_colour?, #render_colour

Instance Method Details

#nullNilClass Also known as: background, colour, foreground, style

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:

  • (NilClass)


23
24
25
# File 'lib/vedeu/cells/escape.rb', line 23

def null
  nil
end

#textString

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)


32
33
34
# File 'lib/vedeu/cells/escape.rb', line 32

def text
  ''
end

#to_hHash<void> Also known as: to_hash

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.

Return an empty hash as most escape sequences won’t make sense as JSON.

Returns:

  • (Hash<void>)


40
41
42
43
44
45
# File 'lib/vedeu/cells/escape.rb', line 40

def to_h
  {
    type:  type,
    value: value,
  }
end

#to_html(_options = {}) ⇒ String

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.

Return an empty string as most escape sequences won’t make sense as HTML.

Parameters:

  • _options (Hash) (defaults to: {})

    Ignored.

Returns:

  • (String)


53
54
55
# File 'lib/vedeu/cells/escape.rb', line 53

def to_html(_options = {})
  ''
end

#to_sString Also known as: to_str

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)


58
59
60
# File 'lib/vedeu/cells/escape.rb', line 58

def to_s
  value
end

#typeSymbol

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:

  • (Symbol)


64
65
66
# File 'lib/vedeu/cells/escape.rb', line 64

def type
  :escape
end