Sha256: 6138a71c4ec33c7c91d12f07d3f7b74b333eb55ae8911a4e6dc7214c8f85d3d2

Contents?: true

Size: 643 Bytes

Versions: 8

Compression:

Stored size: 643 Bytes

Contents

class String
  def red; colorize(self, "\e[1m\e[31m"); end
  def dark_red; colorize(self, "\e\[31m"); end
  def green; colorize(self, "\e[1m\e[32m"); end
  def dark_green; colorize(self, "\e[32m"); end
  def yellow; colorize(self, "\e[1m\e[33m"); end
  def dark_yellow; colorize(self, "\e[33m"); end
  def blue; colorize(self, "\e[1m\e[34m"); end
  def dark_blue; colorize(self, "\e[34m"); end
  def pur; colorize(self, "\e[1m\e[35m"); end
  def dark_pur; colorize(self, "\e[35m"); end
  def colorize(text, color_code)  
    (STDIN.tty?) ? "#{color_code}#{text}\e[0m" : text
  end

  def numeric?
    true if Float(self) rescue false
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
xcselect-0.1.11 lib/xcselect/string_colors.rb
xcselect-0.1.10 lib/xcselect/string_colors.rb
xcselect-0.1.9 lib/xcselect/string_colors.rb
xcselect-0.1.8 lib/xcselect/string_colors.rb
xcselect-0.1.7 lib/xcselect/string_colors.rb
xcselect-0.1.6 lib/xcselect/string_colors.rb
xcselect-0.1.5 lib/xcselect/string_colors.rb
xcselect-0.1.4 lib/xcselect/string_colors.rb