Class: Colors::Colors

Inherits:
Object
  • Object
show all
Defined in:
lib/Colors.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeColors

Returns a new instance of Colors


17
18
19
# File 'lib/Colors.rb', line 17

def initialize

end

Class Method Details

.generate_colors(amount) ⇒ Object


22
23
24
25
26
27
28
# File 'lib/Colors.rb', line 22

def self.generate_colors(amount)
  # LIST.to_a.sample(amount)
  sample = []
  list = LIST.to_a
  amount.times{ sample << list[Random.rand(list.length-1)] }
  sample
end

.get_color(key) ⇒ Object


30
31
32
# File 'lib/Colors.rb', line 30

def self.get_color(key)
  LIST[key]
end

.get_color_keys(colors) ⇒ Object


34
35
36
37
38
# File 'lib/Colors.rb', line 34

def self.get_color_keys (colors)
  keys_array = []
  colors.each{|key, color| keys_array << key.to_s;}
  return keys_array
end

.get_color_values(colors) ⇒ Object


40
41
42
43
44
# File 'lib/Colors.rb', line 40

def self.get_color_values(colors)
  values_array = []
  colors.each{|key, color| values_array << color}
  values_array
end