質問編集履歴

2

文法の修正

2019/06/21 05:57

投稿

meidochan
meidochan

スコア15

test CHANGED
File without changes
test CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  for num in 0..99999 do
32
32
 
33
-
33
+ num = format('%05d', num)
34
34
 
35
35
  password = Zip::TraditionalDecrypter.new(num)
36
36
 
@@ -40,9 +40,9 @@
40
40
 
41
41
  Zip::InputStream.open(zip_file_name,0,password) do |input|
42
42
 
43
- entry = input.get_next_entry
43
+ entry = input.get_next_entry
44
44
 
45
- if(entry){
45
+ if File.exist?(entry.name)
46
46
 
47
47
  # entry.name...file名
48
48
 
@@ -50,15 +50,15 @@
50
50
 
51
51
  File.write(entry.name,input.read)
52
52
 
53
- puts "#{password} is success"
53
+ puts "#{password} is right"
54
54
 
55
55
  break;
56
56
 
57
- }else{
57
+ else
58
58
 
59
- puts "#{password} is failure"
59
+ puts "#{password} is wrong"
60
60
 
61
- }
61
+ end
62
62
 
63
63
  end
64
64
 

1

2019/06/21 05:57

投稿

meidochan
meidochan

スコア15

test CHANGED
File without changes
test CHANGED
File without changes