Sha256: ea1666b1b5cb6259d2039cc99170499d3a72118a2493979829add7ef588d1ccb

Contents?: true

Size: 495 Bytes

Versions: 1

Compression:

Stored size: 495 Bytes

Contents

class String
  # rubocop:disable Layout/EmptyLineBetweenDefs
  # rubocop:disable Style/SingleLineMethods
  def colorize(color_code) "\e[#{color_code}m#{self}\e[0m"; end

  def bold()   colorize('1'); end
  def invert() colorize('7'); end

  def red()   colorize('31'); end
  def blue()  colorize('34'); end
  def green() colorize('32'); end

  def undent() gsub(/^.{#{slice(/^ +/).length}}/, ''); end
  # rubocop:enable Style/SingleLineMethods
  # rubocop:enable Layout/EmptyLineBetweenDefs
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git-multi-5.0.0 lib/ext/string.rb