Sha256: ecee1e8446bd40d03abe5bd75e167199ec0f78b76ea6df868f2ed48617bbee5a

Contents?: true

Size: 1.05 KB

Versions: 40

Compression:

Stored size: 1.05 KB

Contents

require "openssl"
require "open-uri"
require "multi_json"
require "nokogiri"
require "mustache"
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.check(url, options = Onebox.options)
    StatusCheck.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/status_check"
require_relative "onebox/matcher"
require_relative "onebox/engine"
require_relative "onebox/layout"
require_relative "onebox/view"

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
onebox-1.6.4 lib/onebox.rb
onebox-1.6.3 lib/onebox.rb
onebox-1.6.2 lib/onebox.rb
onebox-1.6.1 lib/onebox.rb
onebox-1.6.0 lib/onebox.rb
onebox-1.5.65 lib/onebox.rb
onebox-1.5.64 lib/onebox.rb
onebox-1.5.63 lib/onebox.rb
onebox-1.5.62 lib/onebox.rb
onebox-1.5.61 lib/onebox.rb
onebox-1.5.60 lib/onebox.rb
onebox-1.5.50 lib/onebox.rb
onebox-1.5.49 lib/onebox.rb
onebox-1.5.48 lib/onebox.rb
onebox-1.5.47 lib/onebox.rb
onebox-1.5.45 lib/onebox.rb
onebox-1.5.44 lib/onebox.rb
onebox-1.5.43 lib/onebox.rb
onebox-1.5.42 lib/onebox.rb
onebox-1.5.41 lib/onebox.rb