Sha256: 9cea59e0cf28ad322741c99c5db981a8cac3179485a2ad5a4fe00890c32978a2

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

module Vedeu

  module Presentation

    module Colour

      module Foreground

        include Vedeu::Repositories::Parent

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

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

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

                          else
                            Vedeu::Colours::Foreground.new

                          end
        end

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

      end # Foreground

    end # Colour

  end # Presentation

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.6.70 lib/vedeu/presentation/foreground.rb