Class: Vedeu::Compositor Private
- Inherits:
-
Object
- Object
- Vedeu::Compositor
- Includes:
- Common
- Defined in:
- lib/vedeu/output/compositor.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.
Combines stored interface layout/geometry with an interface view/buffer to create a single view to be sent to the terminal for output.
Instance Attribute Summary collapse
- #name ⇒ Object readonly private private
Class Method Summary collapse
- .render(name) ⇒ Compositor private
Instance Method Summary collapse
-
#buffer ⇒ Hash
private
private
Returns the attributes of the latest buffer (view).
-
#initialize(name) ⇒ Compositor
constructor
private
Initialize a new Compositor.
-
#interface ⇒ Hash
private
private
Returns the attributes of the named interface (layout).
-
#new_interface ⇒ Hash
private
private
Combine the buffer attributes with the interface attributes.
-
#render ⇒ Array
private
Send the view to the terminal.
-
#view ⇒ String
private
private
Renders the buffer unless empty, otherwise clears the area which the interface occupies.
Methods included from Common
Constructor Details
#initialize(name) ⇒ Compositor
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.
Initialize a new Compositor.
21 22 23 |
# File 'lib/vedeu/output/compositor.rb', line 21 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (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.
34 35 36 |
# File 'lib/vedeu/output/compositor.rb', line 34 def name @name end |
Class Method Details
.render(name) ⇒ Compositor
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.
13 14 15 |
# File 'lib/vedeu/output/compositor.rb', line 13 def self.render(name) new(name).render end |
Instance Method Details
#buffer ⇒ Hash (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 attributes of the latest buffer (view).
76 77 78 |
# File 'lib/vedeu/output/compositor.rb', line 76 def buffer @_buffer ||= Vedeu::Buffers.latest(name) end |
#interface ⇒ Hash (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 attributes of the named interface (layout).
68 69 70 |
# File 'lib/vedeu/output/compositor.rb', line 68 def interface @_interface ||= Vedeu::Interfaces.find(name) end |
#new_interface ⇒ Hash (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.
Combine the buffer attributes with the interface attributes. Buffer presentation attributes will override interface defaults.
56 57 58 59 60 61 62 |
# File 'lib/vedeu/output/compositor.rb', line 56 def new_interface combined = interface combined[:lines] = buffer[:lines] combined[:colour] = buffer[:colour] if defined_value?(buffer[:colour]) combined[:style] = buffer[:style] if defined_value?(buffer[:style]) combined end |
#render ⇒ Array
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.
Send the view to the terminal.
28 29 30 |
# File 'lib/vedeu/output/compositor.rb', line 28 def render Terminal.output(view) end |
#view ⇒ 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.
Renders the buffer unless empty, otherwise clears the area which the interface occupies.
41 42 43 44 45 46 47 48 49 |
# File 'lib/vedeu/output/compositor.rb', line 41 def view if buffer Render.call(Interface.new(new_interface)) else Clear.call(Interface.new(interface)) end end |