class ZSteg::FileCmd::Result
Constants
- COLORMAP_TEXT
- COLORMAP_WORD
Public Instance Methods
colorize(color)
click to toggle source
# File lib/zsteg/file_cmd.rb, line 56 def colorize color if color == :gray # gray whole string "file: #{title}".send(color) else "file: " + title.send(color) end end
to_s()
click to toggle source
# File lib/zsteg/file_cmd.rb, line 36 def to_s if title[/UTF-8 Unicode text/i] begin t = data.force_encoding("UTF-8").encode("UTF-32LE").encode("UTF-8") rescue t = data.force_encoding('binary') end return "utf8: " + t end COLORMAP_TEXT.each do |re,color| return colorize(color) if title[re] end title.downcase.split.each do |word| COLORMAP_WORD.each do |re,color| return colorize(color) if title.index(re) == 0 end end colorize(:yellow) end