Class: Vedeu::Cells::Empty Private

Inherits:
Object
  • Object
show all
Includes:
Presentation, Repositories::Defaults
Defined in:
lib/vedeu/cells/empty.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::Empty object represents an empty cell with no content and is the basis of all the Vedeu::Cells objects.

Direct Known Subclasses

Border, Char, Clear, Cursor, Escape

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Repositories::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

#to_s

Methods included from Presentation::Styles

#parent, #render_style, #style, #style=

Methods included from Presentation::Position

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

Methods included from Presentation::Colour

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

Instance Attribute Details

#nameString|Symbol (readonly)

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 The name of the interface/view this cell belongs to.

Returns:

  • (String|Symbol)

    The name of the interface/view this cell belongs to.



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

def name
  @name
end

#valueString (readonly)

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)


27
28
29
# File 'lib/vedeu/cells/empty.rb', line 27

def value
  @value
end

Instance Method Details

#as_htmlString

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 the value represented as HTML.

Returns:

  • (String)


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

def as_html
  ' '
end

#borderVedeu::Borders::Border (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.



103
104
105
# File 'lib/vedeu/cells/empty.rb', line 103

def border
  Vedeu.borders.by_name(name)
end

#defaultsHash<Symbol => void> (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.

The default options/attributes for a new instance of this class.

Returns:

  • (Hash<Symbol => void>)


92
93
94
95
96
97
98
99
100
# File 'lib/vedeu/cells/empty.rb', line 92

def defaults
  {
    colour:   {},
    name:     '',
    position: nil,
    style:    '',
    value:    '',
  }
end

#eql?(other) ⇒ Boolean Also known as: ==

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.

An object is equal when its values are the same.

Parameters:

  • other (void)

Returns:



40
41
42
# File 'lib/vedeu/cells/empty.rb', line 40

def eql?(other)
  self.class.equal?(other.class) && position == other.position
end

#geometryVedeu::Geometries::Geometry (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.



108
109
110
# File 'lib/vedeu/cells/empty.rb', line 108

def geometry
  Vedeu.geometries.by_name(name)
end

#interfaceVedeu::Interfaces::Interface (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.



113
114
115
# File 'lib/vedeu/cells/empty.rb', line 113

def interface
  Vedeu.interfaces.by_name(name)
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)


46
47
48
# File 'lib/vedeu/cells/empty.rb', line 46

def text
  ' '
end

#to_astString

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)


51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/vedeu/cells/empty.rb', line 51

def to_ast
  [
    '[',
    [
      position.to_ast,
      colour.to_ast,
      style.to_ast,
      ":#{type}",
    ].reject(&:empty?).join(' '),
    ']',
  ].join
end

#to_hHash<Symbol => Hash<Symbol => String>, String> 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.

Returns:

  • (Hash<Symbol => Hash<Symbol => String>, String>)


65
66
67
68
69
70
71
72
# File 'lib/vedeu/cells/empty.rb', line 65

def to_h
  {
    name:  name.to_s,
    style: style.to_s,
    type:  type,
    value: value.to_s,
  }.merge!(colour.to_h).merge!(position.to_h)
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.

Returns the object represented as HTML.

Parameters:

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

    Options provided by Renderers::HTML.

Returns:

  • (String)


80
81
82
# File 'lib/vedeu/cells/empty.rb', line 80

def to_html(options = {})
  Vedeu::Cells::HTML.new(self, options).to_html
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)


85
86
87
# File 'lib/vedeu/cells/empty.rb', line 85

def type
  :empty
end