Sha256: c8c0fd65243f16b803e1b2b7c46bfc88528defa180ee236a98c1cda2eca4c4cc

Contents?: true

Size: 311 Bytes

Versions: 5

Compression:

Stored size: 311 Bytes

Contents

module Onebox
  class Matcher
    def initialize(link)
      @url = link
    end

    def oneboxed
      uri = URI(@url)

      Engine.engines.select do |engine|
        engine === uri
      end.first
    rescue URI::InvalidURIError
      # If it's not a valid URL, don't even match
      nil
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
onebox-1.2.4 lib/onebox/matcher.rb
onebox-1.2.3 lib/onebox/matcher.rb
onebox-1.2.2 lib/onebox/matcher.rb
onebox-1.2.1 lib/onebox/matcher.rb
onebox-1.2.0 lib/onebox/matcher.rb