replacer_bot 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/replacer_bot/helpers.rb +7 -0
- data/lib/replacer_bot/replacer.rb +1 -1
- data/lib/replacer_bot/version.rb +1 -1
- data/spec/lib/replacer_bot/helpers_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c33867a4e5550dc350a9e29c2e9b9e3bf2c6dd44
|
4
|
+
data.tar.gz: b3b044806189b56387cd0a81a6a4eb2f11277e17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae67de7b17728c96e6bd9788e5aac35ea7571505ee3dc1f90f4eb243f0f114710ffa3cf30b681fa56aaf61c75224907069122a2edb40b4375abf591f37cae518
|
7
|
+
data.tar.gz: 355b2801819ee449c21fdbbbedb5caa7bd5e04055c085836a8d3c44c2889047e06f5851b6c67ed8787493cc1a271ee20615f006f27ad78357233e6f0e2e31518
|
data/lib/replacer_bot/helpers.rb
CHANGED
@@ -49,6 +49,13 @@ module ReplacerBot
|
|
49
49
|
string.gsub(/\n+/, ' ').gsub(/ +/, ' ').strip
|
50
50
|
end
|
51
51
|
|
52
|
+
def self.title_case string
|
53
|
+
bits = string.split ''
|
54
|
+
bits[0] = bits[0].upcase
|
55
|
+
|
56
|
+
bits.join ''
|
57
|
+
end
|
58
|
+
|
52
59
|
def self.truncate text
|
53
60
|
return_text = ''
|
54
61
|
text.split.each do |word|
|
@@ -15,7 +15,7 @@ module ReplacerBot
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def tweets
|
18
|
-
search.map { |r| ReplacerBot.truncate ReplacerBot.encode_entities ReplacerBot.replace string: r.text }
|
18
|
+
search.map { |r| ReplacerBot.truncate ReplacerBot.title_case ReplacerBot.encode_entities ReplacerBot.replace string: r.text }
|
19
19
|
end
|
20
20
|
|
21
21
|
def tweet dry_run: false, chatty: false
|
data/lib/replacer_bot/version.rb
CHANGED
@@ -70,6 +70,10 @@ module ReplacerBot
|
|
70
70
|
expect(ReplacerBot.despace " open\n\ndata ").to eq 'open data'
|
71
71
|
end
|
72
72
|
|
73
|
+
it 'upcases the first character' do
|
74
|
+
expect(ReplacerBot.title_case 'lowercase at the start').to eq 'Lowercase at the start'
|
75
|
+
end
|
76
|
+
|
73
77
|
it 'trims to 140 characters nicely' do
|
74
78
|
expect(ReplacerBot.truncate 'FYI via @DBMph: The 2016 proposed budget is now in Taylor Swift format! You may access it on our website: http://t.co/EO6Lep3PeW #Transparency').
|
75
79
|
to eq 'FYI via @DBMph: The 2016 proposed budget is now in Taylor Swift format! You may access it on our website: http://t.co/EO6Lep3PeW'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: replacer_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pikesley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twitter
|