Sha256: 4972187eeab298632b824e5effebd5625aec5e8f87d3f14275cc268eace80eea
Contents?: true
Size: 892 Bytes
Versions: 1
Compression:
Stored size: 892 Bytes
Contents
# $Id: textutils.rb 2192 2005-11-13 11:55:42Z aamine $ require 'nkf' module ReVIEW module TextUtils def detab(str, ts = 8) add = 0 len = nil str.gsub(/\t/) { len = ts - ($`.size + add) % ts add += len - 1 ' ' * len } end def convert_inencoding(str, enc) case enc when /^EUC$/i NKF.nkf("-E -w -m0x", str) when /^SJIS$/i NKF.nkf("-S -w -m0x", str) when /^JIS$/i NKF.nkf("-J -w -m0x", str) when /^UTF-8$/i NKF.nkf("-W -w -m0x", str) else NKF.nkf("-w -m0 -m0x", str) end end def convert_outencoding(str, enc) case enc when /^EUC$/i NKF.nkf("-W -e -m0x", str) when /^SJIS$/i NKF.nkf("-W -s -m0x", str) when /^JIS$/i NKF.nkf("-W -j -m0x", str) else str end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
review-2.0.0.beta1 | lib/review/textutils.rb |