Module: Vedeu::Presentation
- Included in:
- Borders::Border, Cells::Border, Cells::Empty, Interfaces::Interface, Interfaces::Null, Output::Write, Views::Composition, Views::Line, Views::Stream, Views::View
- Defined in:
- lib/vedeu/presentation/all.rb,
lib/vedeu/presentation/style.rb,
lib/vedeu/presentation/colour.rb,
lib/vedeu/presentation/styles.rb,
lib/vedeu/presentation/position.rb,
lib/vedeu/presentation/presentation.rb
Overview
This module allows the sharing of presentation concerns between the models: Interface, View, Line and Stream.
Defined Under Namespace
Modules: Colour, Position, Styles Classes: Style
Instance Method Summary collapse
-
#absent?(variable) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether a variable is nil or empty.
-
#background ⇒ Vedeu::Colours::Background
included
from 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 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 Common
private
Converts one class into another.
-
#boolean(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating the value was a boolean.
-
#boolean?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Boolean.
- #colour ⇒ Vedeu::Colours::Colour included from Colour private
-
#colour=(value) ⇒ Vedeu::Colours::Colour
included
from Colour
private
Allows the setting of the model’s colour by coercing the given value into a Vedeu::Colours::Colour.
- #colour? ⇒ Boolean included from Colour private
-
#escape?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is an escape sequence object (e.g. Cells::Escape.).
-
#falsy?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value should be considered false.
-
#foreground ⇒ Vedeu::Colours::Foreground
included
from 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 Colour
private
Allows the setting of the foreground colour by coercing the given value into a Vedeu::Colours::Foreground colour.
-
#hash?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Hash.
-
#line_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::Line.
- #name ⇒ NilClass|String|Symbol included from Styles
- #named_colour ⇒ Vedeu::Colours::Colour included from Colour private private
- #named_colour? ⇒ Boolean included from Colour private private
-
#numeric?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Fixnum.
- #parent ⇒ NilClass|void included from Styles
- #parent_colour ⇒ Vedeu::Colours::Colour included from Colour private private
- #parent_colour? ⇒ Boolean included from Colour private private
-
#position ⇒ Vedeu::Geometries::Position
included
from Position
private
Gets the position.
-
#position=(value) ⇒ Vedeu::Geometries::Position
included
from Position
private
Sets the position.
-
#position? ⇒ Boolean
included
from Position
private
Returns a boolean indicating the position attribute of the including model is set.
-
#present?(variable) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether a variable has a useful value.
-
#render_colour(&block) ⇒ String
private
Renders the colour attributes of the receiver and yields (to then render the styles).
- #render_position(&block) ⇒ String private
-
#render_style(&block) ⇒ String
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 Common
private
Converts a class name to a lowercase snake case string.
-
#stream_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::Stream.
-
#string?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Fixnum.
-
#style ⇒ Vedeu::Presentation::Style
included
from Styles
When the style for the model exists, return it, otherwise returns the parent style, or an empty Style.
-
#style=(value) ⇒ Vedeu::Presentation::Style
included
from Styles
Allows the setting of the style by coercing the given value into a Style.
-
#to_s ⇒ String
(also: #to_str)
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 Common
private
Returns a boolean indicating whether the value should be considered true.
-
#view_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::View.
-
#x ⇒ Fixnum|NilClass
included
from Position
private
Returns the x coordinate for the model when the position attribute of the including model is set.
-
#y ⇒ Fixnum|NilClass
included
from Position
private
Returns the y coordinate for the model when the position attribute of the including model is set.
Instance Method Details
#absent?(variable) ⇒ Boolean Originally defined in module 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.
#background ⇒ Vedeu::Colours::Background Originally defined in module 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 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 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 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 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.
#colour ⇒ Vedeu::Colours::Colour Originally defined in module 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 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 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.
#escape?(value) ⇒ Boolean Originally defined in module 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 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 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 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.
#hash?(value) ⇒ Boolean Originally defined in module 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.
#line_model? ⇒ Boolean Originally defined in module 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.
#name ⇒ NilClass|String|Symbol Originally defined in module Styles
#named_colour ⇒ Vedeu::Colours::Colour (private) Originally defined in module 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 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 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 Styles
#parent_colour ⇒ Vedeu::Colours::Colour (private) Originally defined in module 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 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 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 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 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 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)
Renders the colour attributes of the receiver and yields (to then render the styles).
28 29 30 |
# File 'lib/vedeu/presentation/presentation.rb', line 28 def render_colour(&block) "#{colour}#{yield}" end |
#render_position(&block) ⇒ String (private)
34 35 36 37 38 |
# File 'lib/vedeu/presentation/presentation.rb', line 34 def render_position(&block) return position.to_s { yield } if position? yield end |
#render_style(&block) ⇒ String (private)
Renders the style attributes of the receiver and yields (to then render the next model, or finally, the content).
45 46 47 |
# File 'lib/vedeu/presentation/presentation.rb', line 45 def render_style(&block) "#{style}#{yield}" end |
#snake_case(klass) ⇒ String Originally defined in module 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 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 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 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 Styles
Allows the setting of the style by coercing the given value into a Vedeu::Presentation::Style.
#to_s ⇒ String Also known as: to_str
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.
16 17 18 |
# File 'lib/vedeu/presentation/presentation.rb', line 16 def to_s render_position { render_colour { render_style { value } } } end |
#truthy?(value) ⇒ Boolean Originally defined in module 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.
#view_model? ⇒ Boolean Originally defined in module 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 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 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.