termtter 0.8.7 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/termtter/twitter.rb +5 -1
- data/lib/termtter/version.rb +1 -1
- metadata +1 -1
data/lib/termtter/twitter.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
require 'highline'
|
4
|
+
require 'termcolor'
|
4
5
|
require 'time'
|
5
6
|
|
6
7
|
module Termtter
|
@@ -49,12 +50,15 @@ module Termtter
|
|
49
50
|
return []
|
50
51
|
end
|
51
52
|
|
53
|
+
configatron.search.set_default(:highlihgt_text_format, '<on_magenta><white>\1</white></on_magenta>')
|
52
54
|
def search(query)
|
53
55
|
results = fetch_as_json(search_url_for("/search.json?q=#{CGI.escape(query)}"))['results']
|
54
56
|
return results.map do |s|
|
55
57
|
status = Status.new
|
56
58
|
status.id = s['id']
|
57
|
-
status.text = CGI.unescapeHTML(s['text']).
|
59
|
+
status.text = CGI.unescapeHTML(s['text']).
|
60
|
+
gsub(/(\n|\r)/, '').
|
61
|
+
gsub(/(#{Regexp.escape(query)})/i, configatron.search.highlihgt_text_format)
|
58
62
|
status.created_at = Time.parse(s["created_at"])
|
59
63
|
status.user_screen_name = s['from_user']
|
60
64
|
status
|
data/lib/termtter/version.rb
CHANGED