Method: Array#extract_color

Defined in:
lib/lib/array.rb

#extract_colorObject

Self extract color.

Returns:

  • boolean



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/lib/array.rb', line 24

def extract_color
  each do |argument|
    if argument.symbol? && String.colors.include?(argument)
      color = argument
      delete(argument)
      return color
    elsif argument.string? && argument.start_with?(':')
      color_candidate = argument.gsub(':', '').to_sym
      color = color_candidate if String.colors.include? color_candidate
      delete(argument)
      return color
    end
  end
  :default
end