Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit dd6eaf1

Browse files
committed
Recover missing timezone ignored by converting RSS object
1 parent 5b76927 commit dd6eaf1

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ ruby '2.4.2'
44

55
gem 'idobata'
66
gem 'pry'
7+
gem 'activesupport'

Gemfile.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4+
activesupport (5.1.4)
5+
concurrent-ruby (~> 1.0, >= 1.0.2)
6+
i18n (~> 0.7)
7+
minitest (~> 5.1)
8+
tzinfo (~> 1.1)
49
coderay (1.1.0)
10+
concurrent-ruby (1.0.5)
511
faraday (0.9.2)
612
multipart-post (>= 1.2, < 3)
13+
i18n (0.8.6)
714
idobata (0.0.9)
815
faraday (>= 0.8.8)
916
method_source (0.8.2)
17+
minitest (5.10.3)
1018
multipart-post (2.0.0)
1119
pry (0.10.2)
1220
coderay (~> 1.1.0)
1321
method_source (~> 0.8.1)
1422
slop (~> 3.4)
1523
slop (3.6.0)
24+
thread_safe (0.3.6)
25+
tzinfo (1.2.3)
26+
thread_safe (~> 0.1)
1627

1728
PLATFORMS
1829
ruby
1930

2031
DEPENDENCIES
32+
activesupport
2133
idobata
2234
pry
2335

qiita2idobata.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
require 'rss'
55
require 'idobata'
6+
require 'active_support/all'
67
require 'pry'
78

89
Idobata.hook_url = ENV['IDOBATA_END']
@@ -18,8 +19,9 @@
1819

1920
# NOTE: Heroku Scheduler's frequency should be set to "Every 10 minutes"
2021
articles = rss.items.select do |item|
21-
#(Time.now - item.published.content) / 60 <= 10000 # for debugging
22-
(Time.now - item.published.content) / 60 <= 10
22+
# TODO: RSS object deletes timezone, so we need to recover it into JST
23+
#(Time.now - (item.published.content - 9.hours)) / 60 <= 10000 # for debugging
24+
(Time.now - (item.published.content - 9.hours)) / 60 <= 10
2325
end
2426

2527
msg << articles.map {|a|

0 commit comments

Comments
 (0)