Sha256: eeb3ba16fb3fd3704c90429ca7b59932a9e97b2356827740a1fed8c605c618fd

Contents?: true

Size: 973 Bytes

Versions: 10

Compression:

Stored size: 973 Bytes

Contents

require "open-uri"
require "multi_json"
require "nokogiri"
require "mustache"
require "hexpress"
require "hexpress/web"
require "ostruct"
require "moneta"
require "cgi"
require "net/http"
require "digest"

module Onebox
  DEFAULTS = {
    cache: Moneta.new(:Memory, expires: true, serializer: :json),
    connect_timeout: 5,
    timeout: 10,
    load_paths: [File.join(Gem::Specification.find_by_name("onebox").gem_dir, "templates")]
  }

  @@options = DEFAULTS

  def self.preview(url, options = Onebox.options)
    Preview.new(url, options)
  end

  def self.options
    OpenStruct.new(@@options)
  end

  def self.has_matcher?(url)
    result = Matcher.new(url).oneboxed
    !!result
  end

  def self.options=(options)
    @@options = DEFAULTS.merge(options)
  end
end

require_relative "onebox/version"
require_relative "onebox/preview"
require_relative "onebox/matcher"
require_relative "onebox/engine"
require_relative "onebox/layout"
require_relative "onebox/view"

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
onebox-1.3.8 lib/onebox.rb
onebox-1.3.7 lib/onebox.rb
onebox-1.3.6 lib/onebox.rb
onebox-1.3.5 lib/onebox.rb
onebox-1.3.4 lib/onebox.rb
onebox-1.3.3 lib/onebox.rb
onebox-1.3.2 lib/onebox.rb
onebox-1.3.1 lib/onebox.rb
onebox-1.3.0 lib/onebox.rb
onebox-1.2.9 lib/onebox.rb