Class: Vedeu::Composition
- Inherits:
-
Object
- Object
- Vedeu::Composition
- Includes:
- Model, Presentation
- Defined in:
- lib/vedeu/models/view/composition.rb
Overview
A composition is a collection of interfaces.
Instance Attribute Summary
Attributes included from Model
Instance Method Summary collapse
- #add(child) ⇒ void
-
#defaults ⇒ Hash
private
The default values for a new instance of this class.
-
#initialize(attributes = {}) ⇒ Composition
constructor
Returns a new instance of Composition.
- #interfaces ⇒ Vedeu::Interfaces (also: #value)
Methods included from Presentation
#background, #colour, #colour=, #foreground, #parent_background, #parent_colour, #parent_foreground, #parent_style, #render_border, #render_colour, #render_position, #render_style, #style, #style=, #to_s
Methods included from Model
#demodulize, #deputy, #dsl_class, included, #store
Constructor Details
#initialize(attributes = {}) ⇒ Composition
Returns a new instance of Composition.
28 29 30 31 32 33 34 35 |
# File 'lib/vedeu/models/view/composition.rb', line 28 def initialize(attributes = {}) @attributes = defaults.merge!(attributes) @colour = @attributes[:colour] @interfaces = @attributes[:interfaces] @repository = Vedeu.interfaces @style = @attributes[:style] end |
Instance Method Details
#add(child) ⇒ void
This method returns an undefined value.
39 40 41 |
# File 'lib/vedeu/models/view/composition.rb', line 39 def add(child) @interfaces = interfaces.add(child) end |
#defaults ⇒ Hash (private)
The default values for a new instance of this class.
54 55 56 57 58 59 60 61 |
# File 'lib/vedeu/models/view/composition.rb', line 54 def defaults { client: nil, colour: nil, interfaces: [], style: nil, } end |
#interfaces ⇒ Vedeu::Interfaces Also known as: value
44 45 46 |
# File 'lib/vedeu/models/view/composition.rb', line 44 def interfaces collection.coerce(@interfaces, self) end |