Class: Vedeu::Views::Composition
- Inherits:
-
Object
- Object
- Vedeu::Views::Composition
- Includes:
- Presentation, Repositories::Model, Value
- Defined in:
- lib/vedeu/views/composition.rb
Overview
A composition is a collection of interfaces.
Instance Attribute Summary
Attributes included from Repositories::Model
Instance Method Summary collapse
-
#add(child) ⇒ Vedeu::Views::Views
(also: #<<)
Adds the child to the collection.
- #attributes ⇒ Hash<Symbol => void>
-
#defaults ⇒ Hash<Symbol => void>
private
The default options/attributes for a new instance of this class.
-
#initialize(attributes = {}) ⇒ Vedeu::Views::Composition
constructor
Returns a new instance of Vedeu::Views::Composition.
- #update_buffers(refresh = false) ⇒ Vedeu::Views::Composition
Methods included from Value
Methods included from Presentation
Methods included from Presentation::Styles
#name, #parent, #render_style, #style, #style=
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?
Methods included from Presentation::Position
#position, #position=, #position?, #render_position, #x, #y
Methods included from Presentation::Colour
#background, #background=, #colour, #colour=, #colour?, #foreground, #foreground=, #name, #named_colour, #named_colour?, #parent, #parent_colour, #parent_colour?, #render_colour
Methods included from Repositories::Model
Constructor Details
#initialize(attributes = {}) ⇒ Vedeu::Views::Composition
Returns a new instance of Vedeu::Views::Composition.
35 36 37 38 39 |
# File 'lib/vedeu/views/composition.rb', line 35 def initialize(attributes = {}) defaults.merge!(attributes).each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Method Details
#add(child) ⇒ Vedeu::Views::Views Also known as: <<
Adds the child to the collection.
45 46 47 |
# File 'lib/vedeu/views/composition.rb', line 45 def add(child) @value = value.add(child) end |
#attributes ⇒ Hash<Symbol => void>
51 52 53 54 55 56 57 58 59 |
# File 'lib/vedeu/views/composition.rb', line 51 def attributes { client: client, colour: colour, parent: parent, style: style, value: value, } end |
#defaults ⇒ Hash<Symbol => void> (private)
The default options/attributes for a new instance of this class.
74 75 76 77 78 79 80 81 82 |
# File 'lib/vedeu/views/composition.rb', line 74 def defaults { client: nil, colour: nil, parent: nil, style: nil, value: [], } end |
#update_buffers(refresh = false) ⇒ Vedeu::Views::Composition
65 66 67 68 69 |
# File 'lib/vedeu/views/composition.rb', line 65 def update_buffers(refresh = false) views.each { |view| view.update_buffer(refresh) } if views? self end |