termtter 0.8.7 → 0.8.8

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.
@@ -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']).gsub(/(\n|\r)/, '').gsub(/#{Regexp.escape(query)}/i, color(color('\0', 41), 37))
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
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  module Termtter
3
- VERSION = '0.8.7'
3
+ VERSION = '0.8.8'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: termtter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.7
4
+ version: 0.8.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - jugyo