class Color
Attributes
kleur[RW]
temp[RW]
Public Class Methods
new(kleur,temp)
click to toggle source
# File lib/color.rb, line 3 def initialize(kleur,temp) @temp = temp get_kolor(kleur) end
Public Instance Methods
get_kolor(kleur)
click to toggle source
# File lib/color.rb, line 8 def get_kolor(kleur) if kleur == "Red" @kleur = @temp.to_i.to_s(16) + "0000" if @kleur.length == 5 @kleur = @temp.to_i.to_s(16) + @kleur end end if kleur == "Blue" @kleur = @temp.to_i.abs.to_s(16) +"ff" if @kleur.length == 3 @kleur = @temp.to_i.abs.to_s(16) + @kleur end @kleur = "00" + @kleur end if kleur == "Green" @kleur = "00ff00" end end