Class: Vedeu::Interfaces::Clear Private
- Inherits:
-
Object
- Object
- Vedeu::Interfaces::Clear
- Includes:
- Common
- Defined in:
- lib/vedeu/interfaces/clear.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.
Clear the named interface.
Instance Attribute Summary collapse
-
#name ⇒ NilClass|Symbol|String
readonly
protected
private
The name of the model, the target model or the name of the associated model.
Class Method Summary collapse
-
.by_name ⇒ Array<Array<Vedeu::Cells::Char>>
private
-
.clear_by_name ⇒ Array<Array<Vedeu::Cells::Char>>
private
-
.render(name = Vedeu.focus) ⇒ Array<Array<Vedeu::Cells::Char>>
private
Instance Method Summary collapse
-
#chars ⇒ String
private
private
A string of blank characters.
- #colour ⇒ Vedeu::Colours::Colour private private
-
#geometry ⇒ Vedeu::Geometries::Geometry
private
private
Returns the named geometry from the geometries repository.
- #height ⇒ Fixnum private private
-
#initialize(name = Vedeu.focus) ⇒ Vedeu::Interfaces::Clear
constructor
private
Return a new instance of Vedeu::Interfaces::Clear.
-
#interface ⇒ Vedeu::Interfaces::Interface
private
private
Returns the named interface/view from the interfaces repository.
-
#output ⇒ Array<Array<Vedeu::Cells::Char>>
private
private
For each visible line of the interface, set the foreground and background colours to those specified when the interface was defined, then starting write space characters over the area which the interface occupies.
-
#output_attributes(iy, ix) ⇒ Hash<Symbol => ]
private
private
Hash<Symbol => ].
- #render ⇒ Array<Array<Vedeu::Cells::Char>> private
- #width ⇒ Fixnum private private
- #x ⇒ Fixnum private private
- #y ⇒ Fixnum private private
Methods included from Common
#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?
Constructor Details
#initialize(name = Vedeu.focus) ⇒ Vedeu::Interfaces::Clear
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.
Return a new instance of Vedeu::Interfaces::Clear.
34 35 36 |
# File 'lib/vedeu/interfaces/clear.rb', line 34 def initialize(name = Vedeu.focus) @name = present?(name) ? name : Vedeu.focus end |
Instance Attribute Details
#name ⇒ NilClass|Symbol|String (readonly, 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.
Returns The name of the model, the target model or the name of the associated model.
47 48 49 |
# File 'lib/vedeu/interfaces/clear.rb', line 47 def name @name end |
Class Method Details
.by_name ⇒ Array<Array<Vedeu::Cells::Char>>
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.
26 27 28 29 30 |
# File 'lib/vedeu/interfaces/clear.rb', line 26 def render(name = Vedeu.focus) name || Vedeu.focus new(name).render end |
.clear_by_name ⇒ Array<Array<Vedeu::Cells::Char>>
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.
25 26 27 28 29 |
# File 'lib/vedeu/interfaces/clear.rb', line 25 def render(name = Vedeu.focus) name || Vedeu.focus new(name).render end |
.render(name = Vedeu.focus) ⇒ Array<Array<Vedeu::Cells::Char>>
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.
20 21 22 23 24 |
# File 'lib/vedeu/interfaces/clear.rb', line 20 def render(name = Vedeu.focus) name || Vedeu.focus new(name).render end |
Instance Method Details
#chars ⇒ 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.
Returns A string of blank characters.
52 53 54 |
# File 'lib/vedeu/interfaces/clear.rb', line 52 def chars @_chars ||= (' ' * width) end |
#colour ⇒ Vedeu::Colours::Colour (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.
57 58 59 |
# File 'lib/vedeu/interfaces/clear.rb', line 57 def colour @_colour ||= interface.colour 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.
62 63 64 |
# File 'lib/vedeu/interfaces/clear.rb', line 62 def geometry @_geometry ||= Vedeu.geometries.by_name(name) end |
#height ⇒ 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 |
# File 'lib/vedeu/interfaces/clear.rb', line 67 def height @_height ||= geometry.height 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.
72 73 74 |
# File 'lib/vedeu/interfaces/clear.rb', line 72 def interface Vedeu.interfaces.by_name(name) end |
#output ⇒ Array<Array<Vedeu::Cells::Char>> (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.
For each visible line of the interface, set the foreground and background colours to those specified when the interface was defined, then starting write space characters over the area which the interface occupies.
82 83 84 85 86 87 88 89 90 |
# File 'lib/vedeu/interfaces/clear.rb', line 82 def output Vedeu.timer("Clearing interface: '#{name}'") do @_clear ||= Array.new(height) do |iy| Array.new(width) do |ix| Vedeu::Cells::Clear.new(output_attributes(iy, ix)) end end end end |
#output_attributes(iy, ix) ⇒ Hash<Symbol => ] (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 Hash<Symbol => ].
95 96 97 98 99 100 101 |
# File 'lib/vedeu/interfaces/clear.rb', line 95 def output_attributes(iy, ix) { colour: colour, name: name, position: Vedeu::Geometries::Position.new((y + iy), (x + ix)), } end |
#render ⇒ Array<Array<Vedeu::Cells::Char>>
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.
39 40 41 |
# File 'lib/vedeu/interfaces/clear.rb', line 39 def render Vedeu.render_output(output) if Vedeu.ready? end |
#width ⇒ 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.
104 105 106 |
# File 'lib/vedeu/interfaces/clear.rb', line 104 def width @_width ||= geometry.width end |
#x ⇒ 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.
114 115 116 |
# File 'lib/vedeu/interfaces/clear.rb', line 114 def x @_x ||= geometry.x end |
#y ⇒ 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.
109 110 111 |
# File 'lib/vedeu/interfaces/clear.rb', line 109 def y @_y ||= geometry.y end |