Module: Bridgetown::Foundation::CoreExt::String::Colorize

Extended by:
Inclusive::Class
Defined in:
bridgetown-foundation/lib/bridgetown/foundation/core_ext/string.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ansiBridgetown::Foundation::Packages::Ansi



11
# File 'bridgetown-foundation/lib/bridgetown/foundation/core_ext/string.rb', line 11

public_packages def ansi = [Bridgetown::Foundation::Packages::Ansi]

.included(klass) ⇒ Object



13
14
15
16
17
18
19
# File 'bridgetown-foundation/lib/bridgetown/foundation/core_ext/string.rb', line 13

def included(klass)
  ansi.tap do |a|
    a.colors.each_key do |color|
      klass.define_method(color) { |*args| a.public_send(color, self, *args) }
    end
  end
end

Instance Method Details

#reset_ansiObject

Reset output colors back to a regular string output



23
24
25
# File 'bridgetown-foundation/lib/bridgetown/foundation/core_ext/string.rb', line 23

def reset_ansi
  Colorize.ansi.reset(self)
end