twords 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/twords.rb +8 -8
- data/lib/twords/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bd960588a5adf41656a50a83db3a70a527bd128
|
4
|
+
data.tar.gz: da855462537cc299c03e662223b073c528fb2263
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35a78833f558014514f74e06f9ae744add07bc16c0e109adfd6370cfe4bab07e189b2a45e08461e539ba501af3c39a7b26275f0294805f4589ca8f73b1de8f43
|
7
|
+
data.tar.gz: 98ea7895c7cec6745d498aa6b2ffb0164096801628d08589a3889732eb3ce54cec4e3c408fb79c248c5bfabf3232f464026fb1e95a3411f7ba6fe250176105c9
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-

|
2
2
|
|
3
3
|
## Twitter word clouds
|
4
4
|
|
@@ -24,7 +24,7 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
```ruby
|
26
26
|
Twords.config do |config|
|
27
|
-
config.
|
27
|
+
config.rejects = %w[the for and a i of if]
|
28
28
|
config.range = 14
|
29
29
|
config.up_to { Time.now } # A time object to be lazy evaluated. The range is counted backward from here.
|
30
30
|
|
data/lib/twords.rb
CHANGED
@@ -6,7 +6,7 @@ require 'twitter'
|
|
6
6
|
require 'twords/version'
|
7
7
|
|
8
8
|
# Twords.config do |config|
|
9
|
-
# config.
|
9
|
+
# config.rejects = %w[the for and a i of if]
|
10
10
|
# config.max_age = 14
|
11
11
|
# config.up_to { Time.now }
|
12
12
|
#
|
@@ -27,7 +27,7 @@ require 'twords/version'
|
|
27
27
|
# # => { "butts"=>35, "poo"=>32, "pups"=>28, ... }
|
28
28
|
class Twords
|
29
29
|
class << self
|
30
|
-
attr_reader :
|
30
|
+
attr_reader :rejects, :range, :client, :up_to_block
|
31
31
|
|
32
32
|
def config(&block)
|
33
33
|
class_eval(&block)
|
@@ -37,8 +37,8 @@ class Twords
|
|
37
37
|
@client = Twitter::REST::Client.new(&block)
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
41
|
-
@
|
40
|
+
def rejects=(*args)
|
41
|
+
@rejects = args.flatten
|
42
42
|
end
|
43
43
|
|
44
44
|
def range=(integer)
|
@@ -93,9 +93,9 @@ class Twords
|
|
93
93
|
return timeline if age_of_tweet_in_days(timeline.last) > range
|
94
94
|
@requests += 1
|
95
95
|
timeline += client.user_timeline(
|
96
|
-
|
97
|
-
|
98
|
-
|
96
|
+
screen_name,
|
97
|
+
max_id: timeline.last.id - 1,
|
98
|
+
count: 200
|
99
99
|
)
|
100
100
|
fetch_older_tweets(timeline, screen_name)
|
101
101
|
end
|
@@ -115,7 +115,7 @@ class Twords
|
|
115
115
|
tweet_with_full_text = fetch_tweet_with_full_text(tweet)
|
116
116
|
words_array = tweet_with_full_text.attrs[:full_text].downcase.split(' ')
|
117
117
|
words_array.each do |word|
|
118
|
-
next if self.class.
|
118
|
+
next if self.class.rejects.include?(word)
|
119
119
|
if words.has_key?(word)
|
120
120
|
words[word] += 1
|
121
121
|
else
|
data/lib/twords/version.rb
CHANGED