class String
Public Class Methods
colorize(text, color_code)
click to toggle source
# File lib/github_downloader/string.rb, line 2 def self.colorize(text, color_code) "\e[#{color_code}m#{text}\e[0m" end
Public Instance Methods
blank?()
click to toggle source
# File lib/github_downloader/string.rb, line 34 def blank? self.nil? || self.empty? end
cyan()
click to toggle source
# File lib/github_downloader/string.rb, line 6 def cyan self.class.colorize(self, 36) end
green()
click to toggle source
# File lib/github_downloader/string.rb, line 10 def green self.class.colorize(self, 32) end
red()
click to toggle source
# File lib/github_downloader/string.rb, line 18 def red self.class.colorize(self, 31) end
uncapitalize()
click to toggle source
# File lib/github_downloader/string.rb, line 30 def uncapitalize self[0, 1].downcase + self[1..-1] end
underscore()
click to toggle source
# File lib/github_downloader/string.rb, line 22 def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2'). gsub(/([a-z\d])([A-Z])/, '\1_\2'). tr("-", "_"). downcase end
yellow()
click to toggle source
# File lib/github_downloader/string.rb, line 14 def yellow self.class.colorize(self, 33) end