Module: Colored

Defined in:
lib/colored/not.rb

Class Method Summary collapse

Class Method Details

.not!Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/colored/not.rb', line 16

def not!
  String.class_eval do
    colors = COLORS.keys
    (
      EXTRAS.keys - %w[clear] +
      colors +
      colors.map { |c| "on_#{c}" } +
      colors.product(colors).reject { |p| p.inject(:==) }.map { |p| p.join '_on_' }
    ).map(&:to_sym).each do |m|
      undef_method m
      alias_method m, :dup
    end
  end
end