Sha256: e6632f02d9953a578feb661a801eab2ca07bf25e191225d1fb666f18309c9f35

Contents?: true

Size: 1.38 KB

Versions: 7

Compression:

Stored size: 1.38 KB

Contents

module Vedeu

  module Presentation

    module Colour

      # Provides the background colour when included in a class with
      # a colour attribute.
      #
      # @api private
      #
      module Background

        include Vedeu::Repositories::Parent

        # When the background colour for the model exists, return it,
        # otherwise returns the parent background colour, or an empty
        # Vedeu::Colours::Background.
        #
        # @return [Vedeu::Colours::Background]
        def background
          @background ||= if colour && present?(colour.background)
                            colour.background

                          elsif self.is_a?(Vedeu::Views::Char) && name
                            interface.colour.background

                          elsif parent && present?(parent.background)
                            parent.background

                          else
                            Vedeu::Colours::Background.new

                          end
        end

        # Allows the setting of the background colour by coercing the
        # given value into a Vedeu::Colours::Background colour.
        #
        # @return [Vedeu::Colours::Background]
        def background=(value)
          @background = colour.background = value
          @_colour = @colour = colour
        end

      end # Background

    end # Colour

  end # Presentation

end # Vedeu

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vedeu-0.8.0 lib/vedeu/presentation/background.rb
vedeu-0.7.4 lib/vedeu/presentation/background.rb
vedeu-0.7.3 lib/vedeu/presentation/background.rb
vedeu-0.7.2 lib/vedeu/presentation/background.rb
vedeu-0.7.1 lib/vedeu/presentation/background.rb
vedeu-0.7.0 lib/vedeu/presentation/background.rb
vedeu-0.6.71 lib/vedeu/presentation/background.rb