Class: Vedeu::Colour

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/models/colour.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Colour

Returns a new instance of Colour.



3
4
5
# File 'lib/vedeu/models/colour.rb', line 3

def initialize(attributes = {})
  @attributes = attributes
end

Instance Method Details

#attributesObject



7
8
9
# File 'lib/vedeu/models/colour.rb', line 7

def attributes
  defaults.merge!(@attributes)
end

#backgroundObject



15
16
17
# File 'lib/vedeu/models/colour.rb', line 15

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

#foregroundObject



11
12
13
# File 'lib/vedeu/models/colour.rb', line 11

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

#to_sObject



19
20
21
# File 'lib/vedeu/models/colour.rb', line 19

def to_s
  foreground + background
end