earthquake 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.8
1
+ 0.6.9
data/earthquake.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{earthquake}
8
- s.version = "0.6.8"
8
+ s.version = "0.6.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jugyo"]
@@ -46,8 +46,8 @@ class String
46
46
  def coloring(pattern, color = nil, &block)
47
47
  self.gsub(pattern) do |i|
48
48
  applied_colors = self[0...$~.begin(0)].scan(/\e\[[\d;]+m/)
49
- color ||= block.call(i)
50
- "#{i.c(color)}#{applied_colors.join}"
49
+ c = color || block.call(i)
50
+ "#{i.c(c)}#{applied_colors.join}"
51
51
  end
52
52
  end
53
53
 
@@ -54,7 +54,7 @@ module Earthquake
54
54
  end
55
55
 
56
56
  def color_of(screen_name)
57
- config[:colors][screen_name.to_i(36) % config[:colors].size]
57
+ config[:colors][screen_name.delete("^0-9A-Za-z_").to_i(36) % config[:colors].size]
58
58
  end
59
59
  end
60
60
 
@@ -92,8 +92,8 @@ module Earthquake
92
92
 
93
93
  text = item["text"].u
94
94
  text.gsub!(/\s+/, ' ') unless config[:raw_text]
95
- text = text.coloring(/@([0-9A-Za-z_]+)/) { |i| color_of(i) }
96
- text = text.coloring(/(?:^#([^\s]+))|(?:\s+#([^\s]+))/) { |i| color_of(i) }
95
+ text = text.coloring(/@[0-9A-Za-z_]+/) { |i| color_of(i) }
96
+ text = text.coloring(/(^#[^\s]+)|(\s+#[^\s]+)/) { |i| color_of(i) }
97
97
  text = text.coloring(URI.regexp(["http", "https"]), :url)
98
98
 
99
99
  if item["_highlights"]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: earthquake
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.6.8
5
+ version: 0.6.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - jugyo