Sha256: 1494fc5b2dbf5bc6e7fa8bba4c310e913e92ee31ea01359b82bcde496b14e6f2

Contents?: true

Size: 460 Bytes

Versions: 3

Compression:

Stored size: 460 Bytes

Contents

module Onebox
  class Preview
    attr_reader :cache

    def initialize(link, parameters = Onebox.defaults)
      @url = link
      @options = parameters
      @cache = options.cache
      @engine = Matcher.new(@url).oneboxed
    end

    def to_s
      engine.to_html
    end

    def options
      OpenStruct.new(@options)
    end

    private

    def engine
      @engine.new(@url, cache)
    end

    class InvalidURI < StandardError

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
onebox-1.1.0 lib/onebox/preview.rb
onebox-1.0.1 lib/onebox/preview.rb
onebox-1.0.0 lib/onebox/preview.rb