jugyo-termtter 0.8.9 → 0.8.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/termtter/twitter.rb +5 -2
- data/lib/termtter/version.rb +1 -1
- metadata +1 -1
data/lib/termtter/twitter.rb
CHANGED
@@ -50,12 +50,15 @@ module Termtter
|
|
50
50
|
return []
|
51
51
|
end
|
52
52
|
|
53
|
+
configatron.search.set_default(:highlihgt_text_format, '<on_magenta><white>\1</white></on_magenta>')
|
53
54
|
def search(query)
|
54
55
|
results = fetch_as_json(search_url_for("/search.json?q=#{CGI.escape(query)}"))['results']
|
55
56
|
return results.map do |s|
|
56
57
|
status = Status.new
|
57
58
|
status.id = s['id']
|
58
|
-
status.text =
|
59
|
+
status.text = s['text'].
|
60
|
+
gsub(/(\n|\r)/, '').
|
61
|
+
gsub(/(#{Regexp.escape(query)})/i, configatron.search.highlihgt_text_format)
|
59
62
|
status.created_at = Time.parse(s["created_at"])
|
60
63
|
status.user_screen_name = s['from_user']
|
61
64
|
status
|
@@ -95,7 +98,7 @@ module Termtter
|
|
95
98
|
%w(id name screen_name url profile_image_url).each do |key|
|
96
99
|
status.__send__("user_#{key}=".to_sym, s["user"][key])
|
97
100
|
end
|
98
|
-
status.text =
|
101
|
+
status.text = status.text.gsub(/(\n|\r)/, '')
|
99
102
|
status
|
100
103
|
end
|
101
104
|
end
|
data/lib/termtter/version.rb
CHANGED