sarnesjo-twhere 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/lib/twhere.rb +3 -13
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/twhere.rb
CHANGED
@@ -8,8 +8,6 @@ class Twhere
|
|
8
8
|
@locations_file = config[:twhere][:locations_file]
|
9
9
|
@template_file = config[:twhere][:template_file]
|
10
10
|
@tweets_file = config[:twhere][:tweets_file]
|
11
|
-
@include_replies = config[:twhere][:include_replies]
|
12
|
-
@include_unlocated = config[:twhere][:include_unlocated]
|
13
11
|
@twitter_username = config[:twitter][:username]
|
14
12
|
@twitter_password = config[:twitter][:password]
|
15
13
|
@google_maps_api_key = config[:google_maps][:api_key]
|
@@ -37,24 +35,16 @@ class Twhere
|
|
37
35
|
tweets << h unless tweets.include? h
|
38
36
|
end
|
39
37
|
|
40
|
-
tweets.reject! { |t| t[:text] =~ /^@/ } unless @include_replies
|
41
|
-
tweets.reject! { |t| not t[:text] =~ /#[a-z]+/ } unless @include_unlocated
|
42
|
-
|
43
|
-
# sort tweets, oldest first
|
44
|
-
tweets.sort! { |a, b| a[:twitter_id].to_i <=> b[:twitter_id].to_i }
|
45
|
-
|
46
38
|
# save tweets to file
|
47
39
|
File.open(@tweets_file, 'w') { |f| f.puts tweets.to_yaml } if @tweets_file
|
48
40
|
|
49
41
|
# group tweets by location
|
50
42
|
@located_tweets = {}
|
51
|
-
location = nil
|
52
43
|
tweets.each do |t|
|
53
44
|
md = t[:text].match(/#([a-z]+)/)
|
54
|
-
|
55
|
-
|
56
|
-
@located_tweets[
|
57
|
-
@located_tweets[location] << t
|
45
|
+
if md and @locations.keys.include? md[1]
|
46
|
+
@located_tweets[md[1]] ||= []
|
47
|
+
@located_tweets[md[1]] << t
|
58
48
|
end
|
59
49
|
end
|
60
50
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sarnesjo-twhere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Jesper S\xC3\xA4rnesj\xC3\xB6"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-29 00:00:00 -07:00
|
13
13
|
default_executable: twhere
|
14
14
|
dependencies: []
|
15
15
|
|