Class: Vedeu::Cells::Empty Private
- Inherits:
-
Object
- Object
- Vedeu::Cells::Empty
- 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.
Instance Attribute Summary collapse
-
#name ⇒ String|Symbol
readonly
private
The name of the interface/view this cell belongs to.
- #value ⇒ String readonly private
Instance Method Summary collapse
-
#absent?(variable) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether a variable is nil or empty.
-
#as_html ⇒ String
private
Returns the value represented as HTML.
-
#background ⇒ Vedeu::Colours::Background
included
from Presentation::Colour
private
When the background colour for the model exists, return it, otherwise returns the parent background colour, or an empty Vedeu::Colours::Background.
-
#background=(value) ⇒ Vedeu::Colours::Background
included
from Presentation::Colour
private
Allows the setting of the background colour by coercing the given value into a Vedeu::Colours::Background colour.
-
#become(klass, attributes) ⇒ Class
included
from Vedeu::Common
private
Converts one class into another.
-
#boolean(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating the value was a boolean.
-
#boolean?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is a Boolean.
- #border ⇒ Vedeu::Borders::Border private private
- #cell? ⇒ Boolean private
- #colour ⇒ Vedeu::Colours::Colour included from Presentation::Colour private
-
#colour=(value) ⇒ Vedeu::Colours::Colour
included
from Presentation::Colour
private
Allows the setting of the model’s colour by coercing the given value into a Vedeu::Colours::Colour.
- #colour? ⇒ Boolean included from Presentation::Colour private
- #defaults ⇒ Hash<Symbol => Hash<void>|NilClass|String> private private
-
#eql?(other) ⇒ Boolean
(also: #==)
private
An object is equal when its values are the same.
-
#escape?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is an escape sequence object (e.g. Escape.).
-
#falsy?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value should be considered false.
-
#foreground ⇒ Vedeu::Colours::Foreground
included
from Presentation::Colour
private
When the foreground colour for the model exists, return it, otherwise returns the parent foreground colour, or an empty Vedeu::Colours::Foreground.
-
#foreground=(value) ⇒ Vedeu::Colours::Foreground
included
from Presentation::Colour
private
Allows the setting of the foreground colour by coercing the given value into a Vedeu::Colours::Foreground colour.
- #geometry ⇒ Vedeu::Geometries::Geometry private private
-
#hash?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is a Hash.
-
#initialize(attributes = {}) ⇒ void
included
from Repositories::Defaults
private
Returns a new instance of the class including this module.
- #interface ⇒ Vedeu::Interfaces::Interface private private
-
#line_model? ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating the model is a Views::Line.
- #named_colour ⇒ Vedeu::Colours::Colour included from Presentation::Colour private private
- #named_colour? ⇒ Boolean included from Presentation::Colour private private
-
#numeric?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is a Fixnum.
- #parent ⇒ NilClass|void included from Presentation::Styles
- #parent_colour ⇒ Vedeu::Colours::Colour included from Presentation::Colour private private
- #parent_colour? ⇒ Boolean included from Presentation::Colour private private
-
#position ⇒ Vedeu::Geometries::Position
included
from Presentation::Position
private
Gets the position.
-
#position=(value) ⇒ Vedeu::Geometries::Position
included
from Presentation::Position
private
Sets the position.
-
#position? ⇒ Boolean
included
from Presentation::Position
private
Returns a boolean indicating the position attribute of the including model is set.
-
#present?(variable) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether a variable has a useful value.
-
#render_colour(&block) ⇒ String
included
from Presentation
private
Renders the colour attributes of the receiver and yields (to then render the styles).
- #render_position(&block) ⇒ String included from Presentation private
-
#render_style(&block) ⇒ String
included
from Presentation
private
Renders the style attributes of the receiver and yields (to then render the next model, or finally, the content).
-
#snake_case(klass) ⇒ String
included
from Vedeu::Common
private
Converts a class name to a lowercase snake case string.
-
#stream_model? ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating the model is a Views::Stream.
-
#string?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value is a Fixnum.
-
#style ⇒ Vedeu::Presentation::Style
included
from Presentation::Styles
When the style for the model exists, return it, otherwise returns the parent style, or an empty Presentation::Style.
-
#style=(value) ⇒ Vedeu::Presentation::Style
included
from Presentation::Styles
Allows the setting of the style by coercing the given value into a Presentation::Style.
- #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.
-
#to_s ⇒ String
(also: #to_str)
included
from Presentation
Converts the colours and styles to escape sequences, and when the parent model has previously set the colour and style, reverts back to that for consistent formatting.
-
#truthy?(value) ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating whether the value should be considered true.
- #type ⇒ Symbol private
- #validate(attributes) ⇒ Hash included from Repositories::Defaults private private
-
#view_model? ⇒ Boolean
included
from Vedeu::Common
private
Returns a boolean indicating the model is a Views::View.
-
#x ⇒ Fixnum|NilClass
included
from Presentation::Position
private
Returns the x coordinate for the model when the position attribute of the including model is set.
-
#y ⇒ Fixnum|NilClass
included
from Presentation::Position
private
Returns the y coordinate for the model when the position attribute of the including model is set.
Instance Attribute Details
#name ⇒ String|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.
23 24 25 |
# File 'lib/vedeu/cells/empty.rb', line 23 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.
27 28 29 |
# File 'lib/vedeu/cells/empty.rb', line 27 def value @value end |
Instance Method Details
#absent?(variable) ⇒ Boolean Originally defined in module Vedeu::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.
#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.
32 33 34 |
# File 'lib/vedeu/cells/empty.rb', line 32 def as_html ' ' end |
#background ⇒ Vedeu::Colours::Background Originally defined in module Presentation::Colour
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.
When the background colour for the model exists, return it, otherwise returns the parent background colour, or an empty Vedeu::Colours::Background.
#background=(value) ⇒ Vedeu::Colours::Background Originally defined in module Presentation::Colour
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.
Allows the setting of the background colour by coercing the given value into a Vedeu::Colours::Background colour.
#become(klass, attributes) ⇒ Class Originally defined in module Vedeu::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 Vedeu::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 Vedeu::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.
#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.
111 112 113 |
# File 'lib/vedeu/cells/empty.rb', line 111 def border Vedeu.borders.by_name(name) end |
#cell? ⇒ 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.
37 38 39 |
# File 'lib/vedeu/cells/empty.rb', line 37 def cell? true end |
#colour ⇒ Vedeu::Colours::Colour Originally defined in module Presentation::Colour
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.
#colour=(value) ⇒ Vedeu::Colours::Colour Originally defined in module Presentation::Colour
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.
Allows the setting of the model’s colour by coercing the given value into a Vedeu::Colours::Colour.
#colour? ⇒ Boolean Originally defined in module Presentation::Colour
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.
#defaults ⇒ Hash<Symbol => Hash<void>|NilClass|String> (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.
100 101 102 103 104 105 106 107 108 |
# File 'lib/vedeu/cells/empty.rb', line 100 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.
45 46 47 48 49 50 |
# File 'lib/vedeu/cells/empty.rb', line 45 def eql?(other) self.class == other.class && position == other.position && value == other.value && colour == other.colour end |
#escape?(value) ⇒ Boolean Originally defined in module Vedeu::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 Vedeu::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.
#foreground ⇒ Vedeu::Colours::Foreground Originally defined in module Presentation::Colour
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.
When the foreground colour for the model exists, return it, otherwise returns the parent foreground colour, or an empty Vedeu::Colours::Foreground.
#foreground=(value) ⇒ Vedeu::Colours::Foreground Originally defined in module Presentation::Colour
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.
Allows the setting of the foreground colour by coercing the given value into a Vedeu::Colours::Foreground colour.
#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.
116 117 118 |
# File 'lib/vedeu/cells/empty.rb', line 116 def geometry Vedeu.geometries.by_name(name) end |
#hash?(value) ⇒ Boolean Originally defined in module Vedeu::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.
#initialize(attributes = {}) ⇒ void Originally defined in module Repositories::Defaults
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.
If a particular key is missing from the attributes parameter, then it is added with the respective value from #defaults.
Returns a new instance of the class including this module.
#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.
121 122 123 |
# File 'lib/vedeu/cells/empty.rb', line 121 def interface Vedeu.interfaces.by_name(name) end |
#line_model? ⇒ Boolean Originally defined in module Vedeu::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.
#named_colour ⇒ Vedeu::Colours::Colour (private) Originally defined in module Presentation::Colour
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.
#named_colour? ⇒ Boolean (private) Originally defined in module Presentation::Colour
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.
#numeric?(value) ⇒ Boolean Originally defined in module Vedeu::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.
#parent ⇒ NilClass|void Originally defined in module Presentation::Styles
#parent_colour ⇒ Vedeu::Colours::Colour (private) Originally defined in module Presentation::Colour
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.
#parent_colour? ⇒ Boolean (private) Originally defined in module Presentation::Colour
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.
#position ⇒ Vedeu::Geometries::Position Originally defined in module Presentation::Position
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.
Gets the position.
#position=(value) ⇒ Vedeu::Geometries::Position Originally defined in module Presentation::Position
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.
Sets the position.
#position? ⇒ Boolean Originally defined in module Presentation::Position
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 position attribute of the including model is set.
#present?(variable) ⇒ Boolean Originally defined in module Vedeu::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_colour(&block) ⇒ String (private) Originally defined in module Presentation
Renders the colour attributes of the receiver and yields (to then render the styles).
#render_position(&block) ⇒ String (private) Originally defined in module Presentation
#render_style(&block) ⇒ String (private) Originally defined in module Presentation
Renders the style attributes of the receiver and yields (to then render the next model, or finally, the content).
#snake_case(klass) ⇒ String Originally defined in module Vedeu::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.
#stream_model? ⇒ Boolean Originally defined in module Vedeu::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 Vedeu::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.
#style ⇒ Vedeu::Presentation::Style Originally defined in module Presentation::Styles
When the style for the model exists, return it, otherwise returns the parent style, or an empty Vedeu::Presentation::Style.
#style=(value) ⇒ Vedeu::Presentation::Style Originally defined in module Presentation::Styles
Allows the setting of the style by coercing the given value into a Vedeu::Presentation::Style.
#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.
54 55 56 |
# File 'lib/vedeu/cells/empty.rb', line 54 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.
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/vedeu/cells/empty.rb', line 59 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.
73 74 75 76 77 78 79 80 |
# File 'lib/vedeu/cells/empty.rb', line 73 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.
88 89 90 |
# File 'lib/vedeu/cells/empty.rb', line 88 def to_html( = {}) Vedeu::Cells::HTML.new(self, ).to_html end |
#to_s ⇒ String Also known as: to_str Originally defined in module Presentation
Converts the colours and styles to escape sequences, and when the parent model has previously set the colour and style, reverts back to that for consistent formatting.
#truthy?(value) ⇒ Boolean Originally defined in module Vedeu::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.
#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.
93 94 95 |
# File 'lib/vedeu/cells/empty.rb', line 93 def type :empty end |
#validate(attributes) ⇒ Hash (private) Originally defined in module Repositories::Defaults
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.
#view_model? ⇒ Boolean Originally defined in module Vedeu::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.
#x ⇒ Fixnum|NilClass Originally defined in module Presentation::Position
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 x coordinate for the model when the position attribute of the including model is set.
#y ⇒ Fixnum|NilClass Originally defined in module Presentation::Position
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 y coordinate for the model when the position attribute of the including model is set.