Class: Vedeu::Composition
- Inherits:
-
Object
- Object
- Vedeu::Composition
- Includes:
- Model, Presentation
- Defined in:
- lib/vedeu/models/composition.rb
Overview
A composition is a collection of interfaces.
Instance Attribute Summary collapse
- #attributes ⇒ Hash readonly
Attributes included from Model
Instance Method Summary collapse
- #add(child) ⇒ Vedeu::Interfaces
-
#defaults ⇒ Hash
private
The default values for a new instance of this class.
-
#initialize(attributes = {}) ⇒ Composition
constructor
Returns a new instance of Vedeu::Composition.
- #interfaces ⇒ Vedeu::Interfaces (also: #value)
-
#parent ⇒ NilClass
Composition objects do not have a parent.
Methods included from Presentation
#_colour, #_style, #background, #background=, #colour, #colour=, #foreground, #foreground=, #parent_background, #parent_colour, #parent_foreground, #parent_style, #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 Vedeu::Composition.
23 24 25 26 27 |
# File 'lib/vedeu/models/composition.rb', line 23 def initialize(attributes = {}) @attributes = defaults.merge!(attributes) @interfaces = @attributes[:interfaces] end |
Instance Attribute Details
#attributes ⇒ Hash (readonly)
14 15 16 |
# File 'lib/vedeu/models/composition.rb', line 14 def attributes @attributes end |
Instance Method Details
#add(child) ⇒ Vedeu::Interfaces
31 32 33 |
# File 'lib/vedeu/models/composition.rb', line 31 def add(child) @interfaces = interfaces.add(child) end |
#defaults ⇒ Hash (private)
The default values for a new instance of this class.
53 54 55 56 57 58 59 60 61 |
# File 'lib/vedeu/models/composition.rb', line 53 def defaults { client: nil, colour: nil, interfaces: [], repository: Vedeu.interfaces, style: nil, } end |
#interfaces ⇒ Vedeu::Interfaces Also known as: value
36 37 38 |
# File 'lib/vedeu/models/composition.rb', line 36 def interfaces collection.coerce(@interfaces, self) end |
#parent ⇒ NilClass
Composition objects do not have a parent.
44 45 46 |
# File 'lib/vedeu/models/composition.rb', line 44 def parent nil end |