Sha256: ed9e1fdf21d94fc0c4790608739061a46b56f7d94339fd64ec10de2c4ea19b02

Contents?: true

Size: 544 Bytes

Versions: 3

Compression:

Stored size: 544 Bytes

Contents

module Vedeu
  class Colour
    def initialize(attributes = {})
      @attributes = attributes
    end

    def attributes
      defaults.merge!(@attributes)
    end

    def foreground
      @foreground ||= ColourTranslator.new(attributes[:foreground]).foreground
    end

    def background
      @background ||= ColourTranslator.new(attributes[:background]).background
    end

    def to_s
      foreground + background
    end

    private

    def defaults
      {
        foreground: '',
        background: ''
      }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vedeu-0.1.15 lib/vedeu/models/colour.rb
vedeu-0.1.14 lib/vedeu/models/colour.rb
vedeu-0.1.12 lib/vedeu/models/colour.rb