Class: Vedeu::Compositor
- Inherits:
-
Object
- Object
- Vedeu::Compositor
- Defined in:
- lib/vedeu/output/compositor.rb
Overview
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
Returns the value of attribute name.
Class Method Summary collapse
-
.compose(name) ⇒ Compositor
Convenience method to initialize a new Compositor and call its #compose method.
Instance Method Summary collapse
- #buffer ⇒ Vedeu::Interface private
- #compose ⇒ Array<Interface>
-
#initialize(name) ⇒ Compositor
constructor
Initialize a new Compositor.
- #interface ⇒ Vedeu::Interface private
Constructor Details
#initialize(name) ⇒ Compositor
Initialize a new Compositor.
27 28 29 |
# File 'lib/vedeu/output/compositor.rb', line 27 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly, private)
Returns the value of attribute name.
43 44 45 |
# File 'lib/vedeu/output/compositor.rb', line 43 def name @name end |
Class Method Details
.compose(name) ⇒ Compositor
Convenience method to initialize a new Compositor and call its #compose method.
19 20 21 |
# File 'lib/vedeu/output/compositor.rb', line 19 def self.compose(name) new(name).compose end |
Instance Method Details
#buffer ⇒ Vedeu::Interface (private)
46 47 48 |
# File 'lib/vedeu/output/compositor.rb', line 46 def buffer Vedeu.buffers.find(name).content end |
#compose ⇒ Array<Interface>
32 33 34 35 36 37 38 39 |
# File 'lib/vedeu/output/compositor.rb', line 32 def compose buffer.map do |view| view.colour = interface.colour unless view.colour view.style = interface.style unless view.style Output.render(view) end end |
#interface ⇒ Vedeu::Interface (private)
51 52 53 |
# File 'lib/vedeu/output/compositor.rb', line 51 def interface @interface ||= Vedeu.interfaces.find(name) end |