Sha256: 3ad3d3ab437ab154356ba0bf544fcfa5bca44a04efd3c2a64c867038667dccc7
Contents?: true
Size: 564 Bytes
Versions: 90
Compression:
Stored size: 564 Bytes
Contents
module Onebox class Matcher def initialize(link) @url = link end def ordered_engines @ordered_engines ||= Engine.engines.sort_by do |e| e.respond_to?(:priority) ? e.priority : 100 end end def oneboxed uri = URI(@url) return unless uri.port.nil? || Onebox.options.allowed_ports.include?(uri.port) return unless uri.scheme.nil? || Onebox.options.allowed_schemes.include?(uri.scheme) ordered_engines.find { |engine| engine === uri } rescue URI::InvalidURIError nil end end end
Version data entries
90 entries across 90 versions & 1 rubygems