Class: Vedeu::Interfaces::ClearContent Private
- Inherits:
-
Object
- Object
- Vedeu::Interfaces::ClearContent
- Extended by:
- Forwardable
- Includes:
- Common
- Defined in:
- lib/vedeu/interfaces/clear_content.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 content of 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
Instance Method Summary collapse
-
#chars ⇒ String
private
private
A string of blank characters.
-
#geometry ⇒ Vedeu::Geometries::Geometry
private
private
Returns the named geometry from the geometries repository.
-
#initialize(name = Vedeu.focus) ⇒ Vedeu::Interfaces::ClearContent
constructor
private
Return a new instance of Vedeu::Interfaces::ClearContent.
-
#interface ⇒ Vedeu::Interfaces::Interface
private
private
Returns the named interface/view from the interfaces repository.
- #optimised_line(iy) ⇒ String private private
- #optimised_output ⇒ String private private
-
#output ⇒ Array<Array<Vedeu::Cells::Clear>>
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.
- #render ⇒ Vedeu::Buffers::View 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::ClearContent
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::ClearContent.
40 41 42 |
# File 'lib/vedeu/interfaces/clear_content.rb', line 40 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.
57 58 59 |
# File 'lib/vedeu/interfaces/clear_content.rb', line 57 def name @name end |
Class Method Details
.clear_content_by_name(name = Vedeu.focus) ⇒ Vedeu::Buffers::View
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.
30 31 32 |
# File 'lib/vedeu/interfaces/clear_content.rb', line 30 def clear_content_by_name(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.
62 63 64 |
# File 'lib/vedeu/interfaces/clear_content.rb', line 62 def chars @_chars ||= (' ' * bordered_width) 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.
67 68 69 |
# File 'lib/vedeu/interfaces/clear_content.rb', line 67 def geometry @_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.
72 73 74 |
# File 'lib/vedeu/interfaces/clear_content.rb', line 72 def interface @_interface ||= Vedeu.interfaces.by_name(name) end |
#optimised_line(iy) ⇒ 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.
78 79 80 |
# File 'lib/vedeu/interfaces/clear_content.rb', line 78 def optimised_line(iy) Vedeu::Geometries::Position.new(by + iy, bx).to_s + colour.to_s + chars end |
#optimised_output ⇒ 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.
83 84 85 86 87 88 89 |
# File 'lib/vedeu/interfaces/clear_content.rb', line 83 def optimised_output Vedeu.timer("Optimised clearing content: '#{name}'") do Array.new(bordered_height) do |iy| optimised_line(iy) end.join + Vedeu::Geometries::Position.new(by, bx) end end |
#output ⇒ Array<Array<Vedeu::Cells::Clear>> (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.
97 98 99 100 101 102 103 |
# File 'lib/vedeu/interfaces/clear_content.rb', line 97 def output Vedeu.timer("Clearing content: '#{name}'") do @_clear ||= Vedeu::Buffers::Clear.new(height: bordered_height, name: name, width: bordered_width).buffer end end |
#render ⇒ Vedeu::Buffers::View
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.
45 46 47 48 49 50 51 |
# File 'lib/vedeu/interfaces/clear_content.rb', line 45 def render if Vedeu.ready? Vedeu.direct_write(optimised_output) Vedeu.buffer_update(output) end end |