lib/ykutils/nkfutil19.rb in ykutils-0.1.4 vs lib/ykutils/nkfutil19.rb in ykutils-0.1.6

- old
+ new

@@ -35,22 +35,20 @@ def self.guess_encoding(str) puts "**#{str.encoding}" CODE_TO_NAME[str.encoding.to_s] end - def self.config(src_encoding, dest_encoding, misc_option = nil); end - class Assoc @@hs = {} @@config = nil def self.set(key, value) @@hs[key] = if value - Assoc.convert(value) - else - value - end + Assoc.convert(value) + else + value + end end def self.get(key) @@hs[key] end @@ -63,14 +61,14 @@ @@config = dest_encoding end def self.auto_config_to_inner(str, _misc_option = nil) src_encoding = if str - Assoc.to_nkf_encoding_format(NKFUTIL.guess_encoding(str)) - else - "US-ASCII" - end + Assoc.to_nkf_encoding_format(NKFUTIL.guess_encoding(str)) + else + "US-ASCII" + end # inner_encoding = Assoc.to_nkf_encoding_format( Assoc.get_inner_encoding ) # if inner_encoding != "US-ASCII" # @@config = inner_encoding @@config = nil @@ -154,10 +152,10 @@ end def nkf_utf8_file(infname, outfname) File.open(outfname) do |outf| File.open(infname) do |file| - while line = file.gets + while (line = file.gets) line.chomp! # oline = NKF.nkf( "-w -m0" , line ) oline = line.encode(NAME_TO_ENCODING["UTF8"]) outf.printf("%s\n", oline) end