Class: Vedeu::Cells::Empty Private
- Inherits:
-
Object
- Object
- Vedeu::Cells::Empty
- Includes:
- Presentation, Presentation::Colour, Presentation::Position, Presentation::Styles, 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.
Instance Attribute Summary collapse
-
#name ⇒ NilClass|Symbol|String
readonly
private
The name of the model, the target model or the name of the associated model.
- #value ⇒ String readonly private
Instance Method Summary collapse
-
#as_html ⇒ String
private
Returns the value represented as HTML.
-
#border ⇒ Vedeu::Borders::Border
private
private
Returns the named border from the borders repository.
-
#defaults ⇒ Hash<Symbol => void>
private
private
The default options/attributes for a new instance of this class.
-
#eql?(other) ⇒ Boolean
(also: #==)
private
An object is equal when its values are the same.
-
#geometry ⇒ Vedeu::Geometries::Geometry
private
private
Returns the named geometry from the geometries repository.
-
#interface ⇒ Vedeu::Interfaces::Interface
private
private
Returns the named interface/view from the interfaces repository.
- #text ⇒ String private
- #to_ast ⇒ String private
- #to_h ⇒ Hash<Symbol => Hash<Symbol => String>, String> (also: #to_hash) private
-
#to_html(options = {}) ⇒ String
private
Returns the object represented as HTML.
- #type ⇒ Symbol private
- #value? ⇒ Boolean private
Methods included from Repositories::Defaults
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=, #style?
Methods included from Presentation::Parent
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_colour, #parent_colour?, #render_colour
Methods included from Presentation
Instance Attribute Details
#name ⇒ NilClass|Symbol|String (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 model, the target model or the name of the associated model.
25 26 27 |
# File 'lib/vedeu/cells/empty.rb', line 25 def name @name end |
#value ⇒ String (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.
29 30 31 |
# File 'lib/vedeu/cells/empty.rb', line 29 def value @value end |
Instance Method Details
#as_html ⇒ 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 value represented as HTML.
34 35 36 |
# File 'lib/vedeu/cells/empty.rb', line 34 def as_html ' ' end |
#border ⇒ Vedeu::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.
Returns the named border from the borders repository.
110 111 112 |
# File 'lib/vedeu/cells/empty.rb', line 110 def border Vedeu.borders.by_name(name) end |
#defaults ⇒ Hash<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.
99 100 101 102 103 104 105 106 107 |
# File 'lib/vedeu/cells/empty.rb', line 99 def defaults { colour: {}, name: nil, 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.
42 43 44 |
# File 'lib/vedeu/cells/empty.rb', line 42 def eql?(other) self.class.equal?(other.class) && position == other.position end |
#geometry ⇒ Vedeu::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.
Returns the named geometry from the geometries repository.
115 116 117 |
# File 'lib/vedeu/cells/empty.rb', line 115 def geometry Vedeu.geometries.by_name(name) end |
#interface ⇒ Vedeu::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.
Returns the named interface/view from the interfaces repository.
120 121 122 |
# File 'lib/vedeu/cells/empty.rb', line 120 def interface Vedeu.interfaces.by_name(name) end |
#text ⇒ 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.
48 49 50 |
# File 'lib/vedeu/cells/empty.rb', line 48 def text ' ' end |
#to_ast ⇒ 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.
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/vedeu/cells/empty.rb', line 53 def to_ast [ '[', [ position.to_ast, colour.to_ast, style.to_ast, ":#{type}", ].reject(&:empty?).join(' '), ']', ].join end |
#to_h ⇒ Hash<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.
67 68 69 70 71 72 73 74 |
# File 'lib/vedeu/cells/empty.rb', line 67 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.
82 83 84 |
# File 'lib/vedeu/cells/empty.rb', line 82 def to_html( = {}) Vedeu::Cells::HTML.new(self, ).to_html end |
#type ⇒ Symbol
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.
87 88 89 |
# File 'lib/vedeu/cells/empty.rb', line 87 def type :empty end |
#value? ⇒ Boolean
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.
92 93 94 |
# File 'lib/vedeu/cells/empty.rb', line 92 def value? present?(value) end |