ykutils 0.1.4 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -1
  3. data/.rubocop.yml +2 -1
  4. data/.rubocop_todo.yml +181 -85
  5. data/Gemfile +11 -11
  6. data/Gemfile.lock +17 -12
  7. data/bin/erubix +1 -1
  8. data/bin/makegrid +4 -4
  9. data/lib/ykutils/debugutils.rb +44 -32
  10. data/lib/ykutils/erubyx.rb +30 -19
  11. data/lib/ykutils/fileoputils.rb +2 -2
  12. data/lib/ykutils/gridlist.rb +49 -49
  13. data/lib/ykutils/lines.rb +143 -143
  14. data/lib/ykutils/lsutils.rb +71 -71
  15. data/lib/ykutils/nginxconfig.rb +40 -41
  16. data/lib/ykutils/nginxconfigfiles.rb +31 -31
  17. data/lib/ykutils/nkfutil.rb +148 -147
  18. data/lib/ykutils/nkfutil19.rb +9 -11
  19. data/lib/ykutils/osutil.rb +16 -16
  20. data/lib/ykutils/retcodex.rb +1 -3
  21. data/lib/ykutils/stext.rb +427 -425
  22. data/lib/ykutils/stextx.rb +32 -32
  23. data/lib/ykutils/stringutils.rb +111 -111
  24. data/lib/ykutils/treemanager.rb +33 -33
  25. data/lib/ykutils/treemanagera.rb +21 -21
  26. data/lib/ykutils/version.rb +1 -1
  27. data/lib/ykutils/xlines.rb +8 -8
  28. data/lib/ykutils/yamlop.rb +227 -227
  29. data/lib/ykutils/yamlxop.rb +35 -35
  30. data/test_data/4servers.erb +7 -7
  31. data/test_data/a.bat +5 -5
  32. data/test_data/a_ncn.bat +12 -12
  33. data/test_data/v103-3-189-127/a.northern-cross.net/base.yml +28 -28
  34. data/test_data/v103-3-189-127/a.northern-cross.net/value_host.yml +1 -1
  35. data/test_data/v103-3-189-127/b.northern-cross.net/base.yml +28 -28
  36. data/test_data/v103-3-189-127/b.northern-cross.net/value_host.yml +1 -1
  37. data/test_data/v103-3-189-127/c.northern-cross.net/base.yml +28 -28
  38. data/test_data/v103-3-189-127/c.northern-cross.net/value_host.yml +1 -1
  39. data/test_data/v103-3-189-127/d.northern-cross.info/base.yml +28 -28
  40. data/test_data/v103-3-189-127/d.northern-cross.info/value_host.yml +1 -1
  41. data/test_data/v103-3-189-127/d.northern-cross.net/base.yml +28 -28
  42. data/test_data/v103-3-189-127/d.northern-cross.net/value_host.yml +1 -1
  43. data/test_data/v103-3-189-127/e.northern-cross.info/base.yml +28 -28
  44. data/test_data/v103-3-189-127/e.northern-cross.info/value_host.yml +1 -1
  45. data/test_data/v103-3-189-127/e.northern-cross.net/base.yml +28 -28
  46. data/test_data/v103-3-189-127/e.northern-cross.net/value_host.yml +1 -1
  47. data/test_data/v103-3-189-127/f.northern-cross.info/base.yml +28 -28
  48. data/test_data/v103-3-189-127/f.northern-cross.info/value_host.yml +1 -1
  49. data/test_data/v103-3-189-127/f.northern-cross.net/base.yml +28 -28
  50. data/test_data/v103-3-189-127/f.northern-cross.net/value_host.yml +1 -1
  51. data/test_data/v103-3-189-127/t_server_1.erb +7 -7
  52. data/test_data/v103-3-189-127/template.erb +21 -21
  53. data/test_data/v103-3-189-127/template_ssl.erb +22 -22
  54. data/test_data/v103-3-189-127/template_ssl_www.erb +12 -12
  55. data/test_data/v103-3-189-127/template_www.erb +24 -24
  56. data/test_data/v103-3-189-127/value.yml +3 -3
  57. data/test_data/v103-3-189-127/value_ssl.yml +5 -5
  58. data/ykutils.gemspec +45 -43
  59. metadata +8 -9
  60. data/_config.yml +0 -1
@@ -1,71 +1,71 @@
1
- require "ykutils/filepermision"
2
- require "pathname"
3
-
4
- module Ykytils
5
- class DirEntryItem
6
- attr_accessor :name, :user, :group, :size, :month, :day, :time, :year, :path, :type, :parent_dir, :valid
7
-
8
- def initialize; end
9
-
10
- def parse(str, parent_dir, valid = true)
11
- ary = str.split(/\s+/)
12
- perm = ary[0]
13
- @type = if perm[0].chr == "d"
14
- :DIRECTORY
15
- else
16
- :FILE
17
- end
18
- @perm = FilePermision.new(ary[0][1..9])
19
- @value = ary[1]
20
- @user = ary[2]
21
- @group = ary[3]
22
- @size = ary[4]
23
- @month = ary[5]
24
- @day = ary[6]
25
- str = ary[7]
26
- if str =~ /:/
27
- @year = Time.now.year
28
- @time = str
29
- else
30
- @year = str
31
- @time = "00:00:00"
32
- end
33
-
34
- @time = ary[7]
35
- @name = ary[8]
36
- @path = File.join(parent_dir, @name)
37
- @parent_dir = parent_dir
38
- @valid = valid
39
- end
40
-
41
- def to_hash
42
- { "type" => @type, "perm" => @perm.to_hash, "value" => @value, "user" => @user, "group" => @group,
43
- "size" => @size, "month" => @month, "day" => @day, "year" => @year,
44
- "time" => @time, "name" => @name, "path" => @path, "parent_dir" => @parent_dir, "valid" => @valid }
45
- end
46
-
47
- def to_csv
48
- "#{@type},#{@perm},#{@value},#{@user},#{@group},#{@size},#{@year},#{@month},#{@day},#{@time},#{@name},#{@parent_dir},#{@valid}"
49
- end
50
-
51
- def directory?
52
- @type === :DIRECTORY
53
- end
54
-
55
- def file?
56
- @type === :FILE
57
- end
58
-
59
- def owner_perm
60
- @perm.owner
61
- end
62
-
63
- def group_perm
64
- @perm.group
65
- end
66
-
67
- def otherr_perm
68
- @perm.other
69
- end
70
- end
71
- end
1
+ require "ykutils/filepermision"
2
+ require "pathname"
3
+
4
+ module Ykytils
5
+ class DirEntryItem
6
+ attr_accessor :name, :user, :group, :size, :month, :day, :time, :year, :path, :type, :parent_dir, :valid
7
+
8
+ def initialize; end
9
+
10
+ def parse(str, parent_dir, valid = true)
11
+ ary = str.split(/\s+/)
12
+ perm = ary[0]
13
+ @type = if perm[0].chr == "d"
14
+ :DIRECTORY
15
+ else
16
+ :FILE
17
+ end
18
+ @perm = FilePermision.new(ary[0][1..9])
19
+ @value = ary[1]
20
+ @user = ary[2]
21
+ @group = ary[3]
22
+ @size = ary[4]
23
+ @month = ary[5]
24
+ @day = ary[6]
25
+ str = ary[7]
26
+ if str =~ /:/
27
+ @year = Time.now.year
28
+ @time = str
29
+ else
30
+ @year = str
31
+ @time = "00:00:00"
32
+ end
33
+
34
+ @time = ary[7]
35
+ @name = ary[8]
36
+ @path = File.join(parent_dir, @name)
37
+ @parent_dir = parent_dir
38
+ @valid = valid
39
+ end
40
+
41
+ def to_hash
42
+ { "type" => @type, "perm" => @perm.to_hash, "value" => @value, "user" => @user, "group" => @group,
43
+ "size" => @size, "month" => @month, "day" => @day, "year" => @year,
44
+ "time" => @time, "name" => @name, "path" => @path, "parent_dir" => @parent_dir, "valid" => @valid }
45
+ end
46
+
47
+ def to_csv
48
+ "#{@type},#{@perm},#{@value},#{@user},#{@group},#{@size},#{@year},#{@month},#{@day},#{@time},#{@name},#{@parent_dir},#{@valid}"
49
+ end
50
+
51
+ def directory?
52
+ @type === :DIRECTORY
53
+ end
54
+
55
+ def file?
56
+ @type === :FILE
57
+ end
58
+
59
+ def owner_perm
60
+ @perm.owner
61
+ end
62
+
63
+ def group_perm
64
+ @perm.group
65
+ end
66
+
67
+ def otherr_perm
68
+ @perm.other
69
+ end
70
+ end
71
+ end
@@ -1,41 +1,40 @@
1
- module Ykutils
2
- class Nginxconfig
3
- def initialize(yaml_path)
4
- #p "yaml_path=#{yaml_path}"
5
- yaml_pn = Pathname.new(yaml_path).cleanpath
6
- @virtual_domain_dir_pn = yaml_pn.parent
7
- @server_dir_pn = @virtual_domain_dir_pn.parent
8
- @common_dir_pn = @server_dir_pn.parent
9
- @hash = YAML.load_file(yaml_pn)
10
- #p @hash
11
- @root = @hash["_root"]
12
- #p @root
13
- root_template_0_pn = Pathname.new(@root["template"]).cleanpath
14
- @root_template_pn = @common_dir_pn + root_template_0_pn
15
- # puts "@root_template_pn=#{@root_template_pn}"
16
- end
17
-
18
- def extract(scope)
19
- hashx = {}
20
- @hash.each do |k, v|
21
- if k !~ /^_/
22
- # puts k
23
- #puts v
24
- pn = Pathname.new(v["template"]).cleanpath
25
- #Pathname.new(v).cleanpath
26
- template_pn = @server_dir_pn + pn
27
- # puts(template_pn)
28
- value_file_path_array = v["value"].map{|x|
29
- @virtual_domain_dir_pn + Pathname.new(x).cleanpath
30
- }
31
- hashx[k] = Ykutils::Erubyx::erubi_render_with_file(template_pn, scope, value_file_path_array)
32
- end
33
- end
34
- template = File.read(@root_template_pn)
35
- template_hash = { TEMPLATE: template,
36
- OBJ: nil
37
- }
38
- Ykutils::Erubyx::erubi_render(template_hash, scope, hashx)
39
- end
40
- end
41
- end
1
+ module Ykutils
2
+ class Nginxconfig
3
+ def initialize(yaml_path)
4
+ # p "yaml_path=#{yaml_path}"
5
+ yaml_pn = Pathname.new(yaml_path).cleanpath
6
+ @virtual_domain_dir_pn = yaml_pn.parent
7
+ @server_dir_pn = @virtual_domain_dir_pn.parent
8
+ @common_dir_pn = @server_dir_pn.parent
9
+ @hash = YAML.load_file(yaml_pn)
10
+ # p @hash
11
+ @root = @hash["_root"]
12
+ # p @root
13
+ root_template_0_pn = Pathname.new(@root["template"]).cleanpath
14
+ @root_template_pn = @common_dir_pn + root_template_0_pn
15
+ # puts "@root_template_pn=#{@root_template_pn}"
16
+ end
17
+
18
+ def extract(scope)
19
+ hashx = {}
20
+ @hash.each do |k, v|
21
+ if k !~ /^_/
22
+ # puts k
23
+ # puts v
24
+ pn = Pathname.new(v["template"]).cleanpath
25
+ # Pathname.new(v).cleanpath
26
+ template_pn = @server_dir_pn + pn
27
+ # puts(template_pn)
28
+ value_file_path_array = v["value"].map { |x|
29
+ @virtual_domain_dir_pn + Pathname.new(x).cleanpath
30
+ }
31
+ hashx[k] = Ykutils::Erubyx::erubi_render_with_file(template_pn, scope, value_file_path_array)
32
+ end
33
+ end
34
+ template = File.read(@root_template_pn)
35
+ template_hash = { TEMPLATE: template,
36
+ OBJ: nil }
37
+ Ykutils::Erubyx::erubi_render(template_hash, scope, hashx)
38
+ end
39
+ end
40
+ end
@@ -1,31 +1,31 @@
1
- module Ykutils
2
- require 'find'
3
- class Nginxconfigfiles
4
- def get_file_list(start_dir, re)
5
- @file_list = []
6
-
7
- Find.find(start_dir){|x|
8
- if x =~ re
9
- #puts x
10
- @file_list << x
11
- Find.prune
12
- end
13
- }
14
- @file_list
15
- end
16
-
17
- def output(file_list)
18
- file_list.map{ |fname|
19
- parent_dir_pn = Pathname.new(fname).cleanpath.parent
20
- vdomain = parent_dir_pn.basename
21
- output_fname = "#{vdomain}.conf"
22
- cli = Nginxconfig.new(fname)
23
- scope = nil
24
- File.open( output_fname, "w"){|f|
25
- x = cli.extract(scope)
26
- f.write(x)
27
- }
28
- }
29
- end
30
- end
31
- end
1
+ module Ykutils
2
+ require 'find'
3
+ class Nginxconfigfiles
4
+ def get_file_list(start_dir, re)
5
+ @file_list = []
6
+
7
+ Find.find(start_dir) { |x|
8
+ if x =~ re
9
+ # puts x
10
+ @file_list << x
11
+ Find.prune
12
+ end
13
+ }
14
+ @file_list
15
+ end
16
+
17
+ def output(file_list)
18
+ file_list.map { |fname|
19
+ parent_dir_pn = Pathname.new(fname).cleanpath.parent
20
+ vdomain = parent_dir_pn.basename
21
+ output_fname = "#{vdomain}.conf"
22
+ cli = Nginxconfig.new(fname)
23
+ scope = nil
24
+ File.open(output_fname, "w") { |f|
25
+ x = cli.extract(scope)
26
+ f.write(x)
27
+ }
28
+ }
29
+ end
30
+ end
31
+ end
@@ -1,147 +1,148 @@
1
- # -*- coding utf-8 -*-
2
-
3
- require "nkf"
4
-
5
- module Ykutils
6
- module NKFUTIL
7
- CODE_TO_NAME = Hash.new("ASCII")
8
- CODE_TO_NAME[NKF::JIS] = "JIS"
9
- CODE_TO_NAME[NKF::EUC] = "EUC"
10
- CODE_TO_NAME[NKF::SJIS] = "SJIS"
11
- CODE_TO_NAME[NKF::BINARY] = "BINARY"
12
- CODE_TO_NAME[NKF::UTF8] = "UTF8" if NKF.const_defined?(:UTF8)
13
-
14
- def self.guess_encoding(str)
15
- CODE_TO_NAME[NKF.guess(str)]
16
- end
17
-
18
- class Assoc
19
- @@hs = {}
20
- @@config = nil
21
-
22
- def self.set(key, value)
23
- @@hs[key] = if value
24
- Assoc.convert(value)
25
- else
26
- value
27
- end
28
- end
29
-
30
- def self.get(key)
31
- @@hs[key]
32
- end
33
-
34
- def self.to_nkf_encoding_format(encoding)
35
- case encoding
36
- when "UTF8"
37
- "w"
38
- else
39
- encoding[0, 1]
40
- end
41
- end
42
-
43
- def self.config(src_encoding, dest_encoding, misc_option = nil)
44
- @@config = "-#{dest_encoding.to_s[0, 1].downcase}#{src_encoding.to_s[0, 1].upcase}"
45
- @@config += " #{misc_option}" unless misc_option.nil?
46
- end
47
-
48
- def self.auto_config_to_inner(str, misc_option = nil)
49
- src_encoding = if str
50
- Assoc.to_nkf_encoding_format(NKFUTIL.guess_encoding(str))
51
- else
52
- "A"
53
- end
54
-
55
- inner_encoding = Assoc.to_nkf_encoding_format(Assoc.get_inner_encoding)
56
- if inner_encoding != "A"
57
- @@config = "-#{inner_encoding.downcase}#{src_encoding.upcase}"
58
- @@config += " #{misc_option}" unless misc_option.nil?
59
- end
60
- src_encoding
61
- end
62
-
63
- def self.auto_config_from_inner(dest_enc, misc_option = nil)
64
- dest_encoding = Assoc.to_nkf_encoding_format(dest_enc)
65
- inner_encoding = Assoc.to_nkf_encoding_format(Assoc.get_inner_encoding)
66
- if inner_encoding != "A"
67
- @@config = "-#{dest_encoding.downcase}#{inner_encoding.upcase}"
68
- @@config += " #{misc_option}" unless misc_option.nil?
69
- end
70
- end
71
-
72
- def self.convert(str)
73
- nstr = nil
74
- unless str.nil?
75
- if @@config.nil?
76
- nstr = str
77
- else
78
- begin
79
- nstr = NKF.nkf(@@config, str)
80
- rescue StandardError => e
81
- puts e
82
- puts "========="
83
- pp caller(0)
84
- end
85
- end
86
- end
87
- nstr
88
- end
89
-
90
- def self.get_inner_encoding
91
- @@inner_encoding = $KCODE == "NONE" ? "ASCII" : $KCODE
92
- end
93
- end
94
-
95
- def self.set(key, value)
96
- Assoc.set(key, value)
97
- end
98
-
99
- def self.get(key)
100
- Assoc.get(key)
101
- end
102
-
103
- def self.convert(str)
104
- if str.nil?
105
- ""
106
- else
107
- Assoc.convert(str)
108
- end
109
- end
110
-
111
- def self.assoc_equal(target, key)
112
- target == key || target == Assoc.get(key)
113
- end
114
-
115
- def self.config(src_encoding, dest_encoding, misc_option = nil)
116
- Assoc.config(src_encoding, dest_encoding, misc_option)
117
- end
118
-
119
- def self.auto_config_to_inner(str, misc_option = nil)
120
- Assoc.auto_config_to_inner(str, misc_option)
121
- end
122
-
123
- def self.auto_config_from_inner(dest_encoding, misc_option = nil)
124
- Assoc.auto_config_to_inner(dest_encoding, misc_option)
125
- end
126
-
127
- def puts_sj(line)
128
- puts NKF.nkf("-Ws -m0", line)
129
- end
130
-
131
- def puts_u(line)
132
- puts NKF.nkf("-Sw -m0", line)
133
- end
134
-
135
- def nkf_utf8_file(infname, outfname)
136
- File.open(outfname) do |outf|
137
- File.open(infname) do |file|
138
- while line = file.gets
139
- line.chomp!
140
- oline = NKF.nkf("-w -m0", line)
141
- outf.printf("%s\n", oline)
142
- end
143
- end
144
- end
145
- end
146
- end
147
- end
1
+ # -*- coding utf-8 -*-
2
+
3
+ require "nkf"
4
+
5
+ module Ykutils
6
+ module NKFUTIL
7
+ CODE_TO_NAME = Hash.new("ASCII")
8
+ CODE_TO_NAME[NKF::JIS] = "JIS"
9
+ CODE_TO_NAME[NKF::EUC] = "EUC"
10
+ CODE_TO_NAME[NKF::SJIS] = "SJIS"
11
+ CODE_TO_NAME[NKF::BINARY] = "BINARY"
12
+ CODE_TO_NAME[NKF::UTF8] = "UTF8" if NKF.const_defined?(:UTF8)
13
+
14
+ def self.guess_encoding(str)
15
+ CODE_TO_NAME[NKF.guess(str)]
16
+ end
17
+
18
+ class Assoc
19
+ @@hs = {}
20
+ @@config = nil
21
+
22
+ def self.set(key, value)
23
+ @@hs[key] = if value
24
+ Assoc.convert(value)
25
+ else
26
+ value
27
+ end
28
+ end
29
+
30
+ def self.get(key)
31
+ @@hs[key]
32
+ end
33
+
34
+ def self.to_nkf_encoding_format(encoding)
35
+ case encoding
36
+ when "UTF8"
37
+ "w"
38
+ else
39
+ encoding[0, 1]
40
+ end
41
+ end
42
+
43
+ def self.config(src_encoding, dest_encoding, misc_option = nil)
44
+ @@config = "-#{dest_encoding.to_s[0, 1].downcase}#{src_encoding.to_s[0, 1].upcase}"
45
+ @@config += " #{misc_option}" unless misc_option.nil?
46
+ end
47
+
48
+ def self.auto_config_to_inner(str, misc_option = nil)
49
+ src_encoding =
50
+ if str
51
+ Assoc.to_nkf_encoding_format(NKFUTIL.guess_encoding(str))
52
+ else
53
+ "A"
54
+ end
55
+
56
+ inner_encoding = Assoc.to_nkf_encoding_format(Assoc.get_inner_encoding)
57
+ if inner_encoding != "A"
58
+ @@config = "-#{inner_encoding.downcase}#{src_encoding.upcase}"
59
+ @@config += " #{misc_option}" unless misc_option.nil?
60
+ end
61
+ src_encoding
62
+ end
63
+
64
+ def self.auto_config_from_inner(dest_enc, misc_option = nil)
65
+ dest_encoding = Assoc.to_nkf_encoding_format(dest_enc)
66
+ inner_encoding = Assoc.to_nkf_encoding_format(Assoc.get_inner_encoding)
67
+ if inner_encoding != "A"
68
+ @@config = "-#{dest_encoding.downcase}#{inner_encoding.upcase}"
69
+ @@config += " #{misc_option}" unless misc_option.nil?
70
+ end
71
+ end
72
+
73
+ def self.convert(str)
74
+ nstr = nil
75
+ unless str.nil?
76
+ if @@config.nil?
77
+ nstr = str
78
+ else
79
+ begin
80
+ nstr = NKF.nkf(@@config, str)
81
+ rescue StandardError => e
82
+ puts e
83
+ puts "========="
84
+ pp caller(0)
85
+ end
86
+ end
87
+ end
88
+ nstr
89
+ end
90
+
91
+ def self.get_inner_encoding
92
+ @@inner_encoding = $KCODE == "NONE" ? "ASCII" : $KCODE
93
+ end
94
+ end
95
+
96
+ def self.set(key, value)
97
+ Assoc.set(key, value)
98
+ end
99
+
100
+ def self.get(key)
101
+ Assoc.get(key)
102
+ end
103
+
104
+ def self.convert(str)
105
+ if str.nil?
106
+ ""
107
+ else
108
+ Assoc.convert(str)
109
+ end
110
+ end
111
+
112
+ def self.assoc_equal(target, key)
113
+ target == key || target == Assoc.get(key)
114
+ end
115
+
116
+ def self.config(src_encoding, dest_encoding, misc_option = nil)
117
+ Assoc.config(src_encoding, dest_encoding, misc_option)
118
+ end
119
+
120
+ def self.auto_config_to_inner(str, misc_option = nil)
121
+ Assoc.auto_config_to_inner(str, misc_option)
122
+ end
123
+
124
+ def self.auto_config_from_inner(dest_encoding, misc_option = nil)
125
+ Assoc.auto_config_to_inner(dest_encoding, misc_option)
126
+ end
127
+
128
+ def puts_sj(line)
129
+ puts NKF.nkf("-Ws -m0", line)
130
+ end
131
+
132
+ def puts_u(line)
133
+ puts NKF.nkf("-Sw -m0", line)
134
+ end
135
+
136
+ def nkf_utf8_file(infname, outfname)
137
+ File.open(outfname) do |outf|
138
+ File.open(infname) do |file|
139
+ while (line = file.gets)
140
+ line.chomp!
141
+ oline = NKF.nkf("-w -m0", line)
142
+ outf.printf("%s\n", oline)
143
+ end
144
+ end
145
+ end
146
+ end
147
+ end
148
+ end
@@ -37,18 +37,16 @@ module Ykutils
37
37
  CODE_TO_NAME[str.encoding.to_s]
38
38
  end
39
39
 
40
- def self.config(src_encoding, dest_encoding, misc_option = nil); end
41
-
42
40
  class Assoc
43
41
  @@hs = {}
44
42
  @@config = nil
45
43
 
46
44
  def self.set(key, value)
47
45
  @@hs[key] = if value
48
- Assoc.convert(value)
49
- else
50
- value
51
- end
46
+ Assoc.convert(value)
47
+ else
48
+ value
49
+ end
52
50
  end
53
51
 
54
52
  def self.get(key)
@@ -65,10 +63,10 @@ module Ykutils
65
63
 
66
64
  def self.auto_config_to_inner(str, _misc_option = nil)
67
65
  src_encoding = if str
68
- Assoc.to_nkf_encoding_format(NKFUTIL.guess_encoding(str))
69
- else
70
- "US-ASCII"
71
- end
66
+ Assoc.to_nkf_encoding_format(NKFUTIL.guess_encoding(str))
67
+ else
68
+ "US-ASCII"
69
+ end
72
70
 
73
71
  # inner_encoding = Assoc.to_nkf_encoding_format( Assoc.get_inner_encoding )
74
72
  # if inner_encoding != "US-ASCII"
@@ -156,7 +154,7 @@ module Ykutils
156
154
  def nkf_utf8_file(infname, outfname)
157
155
  File.open(outfname) do |outf|
158
156
  File.open(infname) do |file|
159
- while line = file.gets
157
+ while (line = file.gets)
160
158
  line.chomp!
161
159
  # oline = NKF.nkf( "-w -m0" , line )
162
160
  oline = line.encode(NAME_TO_ENCODING["UTF8"])
@@ -1,16 +1,16 @@
1
- require "pathname"
2
-
3
- module Ykutils
4
- class OSUtil
5
- @@os = nil
6
-
7
- def self.runtime
8
- @@os ||= if Pathname.pwd.to_s =~ %r{^/cygdrive}
9
- :CYGWIN
10
- else
11
- :ELSE
12
- end
13
- @@os
14
- end
15
- end
16
- end
1
+ require "pathname"
2
+
3
+ module Ykutils
4
+ class OSUtil
5
+ @@os = nil
6
+
7
+ def self.runtime
8
+ @@os ||= if Pathname.pwd.to_s =~ %r{^/cygdrive}
9
+ :CYGWIN
10
+ else
11
+ :ELSE
12
+ end
13
+ @@os
14
+ end
15
+ end
16
+ end
@@ -40,9 +40,7 @@ module Ykutils
40
40
 
41
41
  def initialize(ret, bool, mes)
42
42
  @val = { "ret" => ret, "bool" => bool, "mes" => mes }
43
- @ret = ret
44
- @bool = bool
45
- @mes = mes
43
+ super(@val)
46
44
  end
47
45
  end
48
46
  end