onebox 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a1c79c861fa854b2cb6f8e846858c6d3960a7d7
4
- data.tar.gz: 711cefc867ea1db4cc654f345914e859a1534a1e
3
+ metadata.gz: 66fa788b67da32beda2b5c5f9ee946ab9df91dd4
4
+ data.tar.gz: 44631fb76252c9ca68e1e2b6296efb28d501b1a7
5
5
  SHA512:
6
- metadata.gz: 63ca35b58d58aacef5d7074ae4a205aedcdee285038d93072d92fda68caea97030de36810fb366929373a6afaefe1ee0337c7b0ac4a50325effd99fa7cef57cd
7
- data.tar.gz: 0e2e452056785863e67cff50581d544914022b450a63f675e141fafb3eb1e0b435fabe2ac09b78807f3729829fc3d58d6ed8979b298db0c01f87ca560eb5cc82
6
+ metadata.gz: 6c2da907c156abf1012b4910a481391c0a5e658caa71f7b12e01f05f0059df45372a3d7d6c13da415aaa9bc3e60318f68f77c7c0dc1388cc1a7f75c73f717691
7
+ data.tar.gz: c5b726d096b6c9cda3c39c71ff38c487e4955127e0ad851686f1bcf02ca509bdcc04f32a6b2608cfd441556ce94fa5be89ae3a3a8d22ad61b997719ad6f0e989
@@ -77,6 +77,10 @@ module Onebox
77
77
  end
78
78
  end
79
79
 
80
+ def priority
81
+ 100
82
+ end
83
+
80
84
  def matches(&block)
81
85
  matches_regexp(Hexpress.new(&block).to_r)
82
86
  end
@@ -4,10 +4,16 @@ module Onebox
4
4
  @url = link
5
5
  end
6
6
 
7
+ def ordered_engines
8
+ @ordered_engines ||= Engine.engines.sort_by do |e|
9
+ e.respond_to?(:priority) ? e.priority : 100
10
+ end
11
+ end
12
+
7
13
  def oneboxed
8
14
  uri = URI(@url)
9
15
 
10
- Engine.engines.select do |engine|
16
+ ordered_engines.select do |engine|
11
17
  engine === uri
12
18
  end.first
13
19
  rescue URI::InvalidURIError
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.2.4"
2
+ VERSION = "1.2.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta