Sha256: 7530052c6e2046917338d1376d574c3c4218fc1cb39600c8a863f91c9ed8c774
Contents?: true
Size: 1.65 KB
Versions: 7
Compression:
Stored size: 1.65 KB
Contents
module Vedeu module Views # A composition is a collection of interfaces. # class Composition include Vedeu::Model include Vedeu::Presentation collection Vedeu::Views::ViewCollection member Vedeu::Views::View # @!attribute [r] attributes # @return [Hash] attr_reader :attributes # @!attribute [r] parent # @return [NilClass] Composition objects do not have a parent. attr_reader :parent # Returns a new instance of Vedeu::Views::Composition. # # @param attributes [Hash] # @option attributes client [void] # @option attributes colour [Vedeu::Colours::Colour] # @option attributes style [Vedeu::Style] # @option attributes value [Vedeu::Views::ViewCollection] # @return [Vedeu::Views::Composition] def initialize(attributes = {}) @attributes = defaults.merge!(attributes) @attributes.each do |key, value| instance_variable_set("@#{key}", value) end end # @param child [Vedeu::Views::View] # @return [Vedeu::Views::ViewCollection] def add(child) @value = value.add(child) end alias_method :<<, :add # @return [Vedeu::Views::ViewCollection] def value collection.coerce(@value, self) end alias_method :views, :value private # The default values for a new instance of this class. # # @return [Hash] def defaults { client: nil, colour: nil, parent: nil, style: nil, value: [], } end end # Composition end # Views end # Vedeu
Version data entries
7 entries across 7 versions & 1 rubygems