Class: Vedeu::Output::Write Private
- Inherits:
-
Object
- Object
- Vedeu::Output::Write
- Includes:
- Presentation
- Defined in:
- lib/vedeu/output/write.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.
Directly write to the terminal.
Instance Attribute Summary collapse
- #output ⇒ String readonly private private
Class Method Summary collapse
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 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 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 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 => Fixnum> private 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 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.
-
#hash?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value is a Hash.
-
#initialize(output = nil, options = {}) ⇒ Vedeu::Output::Write
constructor
private
Returns a new instance of Vedeu::Output::Write.
-
#line_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::Line.
- #name ⇒ NilClass|String|Symbol included from Presentation::Styles
- #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 Common
private
Returns a boolean indicating whether the value is a Fixnum.
- #options ⇒ Hash<Symbol => Fixnum> (also: #attributes) private private
- #parent ⇒ NilClass private
- #parent_colour ⇒ Vedeu::Colours::Colour included from Presentation::Colour private private
- #parent_colour? ⇒ Boolean included from Presentation::Colour private private
- #position(pos = position_start) ⇒ Vedeu::Geometries::Position private
-
#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.
- #position_end ⇒ Hash<Symbol => Fixnum> private private
- #position_start ⇒ Hash<Symbol => Fixnum> private private
-
#present?(variable) ⇒ Boolean
included
from 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 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 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.
- #to_s ⇒ String (also: #to_str) private private
-
#truthy?(value) ⇒ Boolean
included
from Common
private
Returns a boolean indicating whether the value should be considered true.
- #value ⇒ String protected private
-
#view_model? ⇒ Boolean
included
from Common
private
Returns a boolean indicating the model is a Views::View.
- #write ⇒ Array<String> private
-
#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.
Constructor Details
#initialize(output = nil, options = {}) ⇒ Vedeu::Output::Write
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 new instance of Vedeu::Output::Write.
33 34 35 36 37 38 |
# File 'lib/vedeu/output/write.rb', line 33 def initialize(output = nil, = {}) @output = output @options = @colour = [:colour] @style = [:style] end |
Instance Attribute Details
#output ⇒ String (readonly, 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.
61 62 63 |
# File 'lib/vedeu/output/write.rb', line 61 def output @output end |
Class Method Details
.write(output = nil, options = {}) ⇒ Object
20 21 22 |
# File 'lib/vedeu/output/write.rb', line 20 def self.write(output = nil, = {}) new(output, ).write end |
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 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 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 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 => Fixnum> (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.
67 68 69 70 71 72 |
# File 'lib/vedeu/output/write.rb', line 67 def defaults { x: 1, y: 1, } end |
#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 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.
#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 Presentation::Styles
#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 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.
#options ⇒ Hash<Symbol => Fixnum> (private) Also known as: attributes
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.
75 76 77 |
# File 'lib/vedeu/output/write.rb', line 75 def defaults.merge!(@options) end |
#parent ⇒ NilClass
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.
41 42 43 |
# File 'lib/vedeu/output/write.rb', line 41 def parent nil end |
#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(pos = position_start) ⇒ Vedeu::Geometries::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.
46 47 48 |
# File 'lib/vedeu/output/write.rb', line 46 def position(pos = position_start) Vedeu::Geometries::Position.coerce(pos) end |
#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.
#position_end ⇒ Hash<Symbol => Fixnum> (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.
94 95 96 97 98 99 |
# File 'lib/vedeu/output/write.rb', line 94 def position_end { x: [:x] + output.size, y: [:y], } end |
#position_start ⇒ Hash<Symbol => Fixnum> (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.
86 87 88 89 90 91 |
# File 'lib/vedeu/output/write.rb', line 86 def position_start { x: [:x], y: [:y], } end |
#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) 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 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 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.
#to_s ⇒ String (private) 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.
102 103 104 |
# File 'lib/vedeu/output/write.rb', line 102 def to_s @_to_s ||= super + Vedeu.esc.reset + position(position_end) 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.
#value ⇒ String (protected)
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.
62 63 64 |
# File 'lib/vedeu/output/write.rb', line 62 def output @output end |
#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.
#write ⇒ Array<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.
51 52 53 54 55 |
# File 'lib/vedeu/output/write.rb', line 51 def write Vedeu.direct_write(to_s) to_s end |
#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.