Sha256: a7f093739bb054ab375c8c3c2614e630fbd8f98ea9777785f9a764fd5f3770ed

Contents?: true

Size: 270 Bytes

Versions: 4

Compression:

Stored size: 270 Bytes

Contents

class String
  COLORS = { red: 31,
    green: 32,
    yellow: 33,
    blue: 34,
    pink: 35
  }

  # colorization
  def colorize(color_code)
    "\e[#{color_code}m#{self}\e[0m"
  end

  COLORS.each do |color, code|
    define_method(color) { colorize(code) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dnsdeploy-0.0.4 lib/core_ext/string.rb
dnsdeploy-0.0.3 lib/core_ext/string.rb
dnsdeploy-0.0.2 lib/core_ext/string.rb
dnsdeploy-0.0.1 lib/core_ext/string.rb