回答編集履歴
1
コメントのアドバイスにしたがいコードを変更
answer
CHANGED
|
@@ -7,16 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
# 現在時刻を保存
|
|
9
9
|
def save_currenttime(file)
|
|
10
|
-
if File.exist?(file)
|
|
11
|
-
n = Time.now
|
|
12
|
-
File.utime(n, n, file)
|
|
13
|
-
else
|
|
14
|
-
|
|
10
|
+
FileUtils.touch(file)
|
|
15
|
-
end
|
|
16
11
|
end
|
|
17
12
|
|
|
18
13
|
# 24時間以上たっていたらtrueを返す
|
|
19
14
|
def check_lastrun(file)
|
|
20
15
|
!File.exist?(file) || ((Time.now - File.mtime(file)) > (61 * 60 * 24))
|
|
21
16
|
end
|
|
22
|
-
```
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**変更履歴:**コメントのアドバイスにしたがいsave_currenttimeの処理を変更。
|