Class: Vedeu::Clear::NamedInterface
- Inherits:
-
Object
- Object
- Vedeu::Clear::NamedInterface
- Defined in:
- lib/vedeu/output/clear/named_interface.rb
Overview
Clear the named interface.
Instance Attribute Summary collapse
- #name ⇒ String readonly protected
Class Method Summary collapse
-
.by_name ⇒ Array<Array<Vedeu::Views::Char>>
Clear the interface with the given name.
-
.clear_by_name ⇒ Array<Array<Vedeu::Views::Char>>
Clear the interface with the given name.
-
.render(name) ⇒ Array<Array<Vedeu::Views::Char>>
Clear the interface with the given name.
Instance Method Summary collapse
- #geometry ⇒ Object private
-
#initialize(name) ⇒ Vedeu::Clear::NamedInterface
constructor
Return a new instance of Vedeu::Clear::NamedInterface.
- #interface ⇒ Object private
-
#output ⇒ Array<Array<Vedeu::Views::Char>>
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 ⇒ Array<Array<Vedeu::Views::Char>>
Constructor Details
#initialize(name) ⇒ Vedeu::Clear::NamedInterface
Return a new instance of Vedeu::Clear::NamedInterface.
32 33 34 |
# File 'lib/vedeu/output/clear/named_interface.rb', line 32 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ String (readonly, protected)
45 46 47 |
# File 'lib/vedeu/output/clear/named_interface.rb', line 45 def name @name end |
Class Method Details
.by_name ⇒ Array<Array<Vedeu::Views::Char>>
Clear the interface with the given name.
24 25 26 |
# File 'lib/vedeu/output/clear/named_interface.rb', line 24 def render(name) new(name).render end |
.clear_by_name ⇒ Array<Array<Vedeu::Views::Char>>
Clear the interface with the given name.
23 24 25 |
# File 'lib/vedeu/output/clear/named_interface.rb', line 23 def render(name) new(name).render end |
.render(name) ⇒ Array<Array<Vedeu::Views::Char>>
Clear the interface with the given name.
20 21 22 |
# File 'lib/vedeu/output/clear/named_interface.rb', line 20 def render(name) new(name).render end |
Instance Method Details
#geometry ⇒ Object (private)
50 51 52 |
# File 'lib/vedeu/output/clear/named_interface.rb', line 50 def geometry @geometry ||= Vedeu.geometries.by_name(name) end |
#interface ⇒ Object (private)
55 56 57 |
# File 'lib/vedeu/output/clear/named_interface.rb', line 55 def interface @interface ||= Vedeu.interfaces.by_name(name) end |
#output ⇒ Array<Array<Vedeu::Views::Char>> (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.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/vedeu/output/clear/named_interface.rb', line 65 def output Vedeu.timer("Clearing: '#{name}'") do @y = geometry.y @x = geometry.x @width = geometry.width @height = geometry.height @colour = interface.colour @clear ||= Array.new(@height) do |iy| Array.new(@width) do |ix| Vedeu::Views::Char.new(value: ' ', colour: @colour, position: [@y + iy, @x + ix]) end end end end |
#render ⇒ Array<Array<Vedeu::Views::Char>>
37 38 39 |
# File 'lib/vedeu/output/clear/named_interface.rb', line 37 def render output end |