lib/mediainfo/string.rb in mediainfo-1.2.2 vs lib/mediainfo/string.rb in mediainfo-1.3.0
- old
+ new
@@ -8,8 +8,26 @@
#
# This should work in al POSIX compatible shells.
#
# see: http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_02_03
def shell_escape_double_quotes
- '"'+gsub(/\\|"|\$|`/, '\\\\\0')+'"'
+ ''+gsub(/\\|"|\$|`/, '\\\\\0')+''
end unless method_defined?(:shell_escape_double_quotes)
+
+ # colorization
+ def colorize(color_code)
+ "\e[#{color_code}m#{self}\e[0m"
+ end
+
+ def red
+ colorize(31)
+ end
+
+ def green
+ colorize(32)
+ end
+
+ def yellow
+ colorize(33)
+ end
+
end