Module: Onebox

Defined in:
lib/onebox.rb,
lib/onebox/web.rb,
lib/onebox/view.rb,
lib/onebox/engine.rb,
lib/onebox/layout.rb,
lib/onebox/helpers.rb,
lib/onebox/matcher.rb,
lib/onebox/preview.rb,
lib/onebox/version.rb,
lib/onebox/engine/html.rb,
lib/onebox/engine/json.rb,
lib/onebox/web_helpers.rb,
lib/onebox/status_check.rb,
lib/onebox/layout_support.rb,
lib/onebox/file_type_finder.rb,
lib/onebox/template_support.rb,
lib/onebox/engine/audio_onebox.rb,
lib/onebox/engine/image_onebox.rb,
lib/onebox/engine/imgur_onebox.rb,
lib/onebox/engine/video_onebox.rb,
lib/onebox/engine/youku_onebox.rb,
lib/onebox/engine/amazon_onebox.rb,
lib/onebox/engine/douban_onebox.rb,
lib/onebox/engine/pubmed_onebox.rb,
lib/onebox/engine/slides_onebox.rb,
lib/onebox/engine/standard_embed.rb,
lib/onebox/engine/youtube_onebox.rb,
lib/onebox/engine/pastebin_onebox.rb,
lib/onebox/engine/wikipedia_onebox.rb,
lib/onebox/engine/soundcloud_onebox.rb,
lib/onebox/engine/github_blob_onebox.rb,
lib/onebox/engine/github_gist_onebox.rb,
lib/onebox/engine/google_docs_onebox.rb,
lib/onebox/engine/google_maps_onebox.rb,
lib/onebox/engine/github_issue_onebox.rb,
lib/onebox/engine/github_commit_onebox.rb,
lib/onebox/engine/stack_exchange_onebox.rb,
lib/onebox/engine/twitter_status_onebox.rb,
lib/onebox/engine/google_calendar_onebox.rb,
lib/onebox/engine/google_play_app_onebox.rb,
lib/onebox/engine/github_pullrequest_onebox.rb,
lib/onebox/engine/steam_store_widget_onebox.rb,
lib/onebox/engine/whitelisted_generic_onebox.rb

Defined Under Namespace

Modules: Engine, FileTypeFinder, Helpers, LayoutSupport, TemplateSupport, WebHelpers Classes: Layout, Matcher, Preview, StatusCheck, View, Web

Constant Summary collapse

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")]
}
VERSION =
"1.5.42"
@@options =
DEFAULTS

Class Method Summary collapse

Class Method Details

.check(url, options = Onebox.options) ⇒ Object


26
27
28
# File 'lib/onebox.rb', line 26

def self.check(url, options = Onebox.options)
  StatusCheck.new(url, options)
end

.has_matcher?(url) ⇒ Boolean

Returns:

  • (Boolean)

34
35
36
37
# File 'lib/onebox.rb', line 34

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

.optionsObject


30
31
32
# File 'lib/onebox.rb', line 30

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

.options=(options) ⇒ Object


39
40
41
# File 'lib/onebox.rb', line 39

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

.preview(url, options = Onebox.options) ⇒ Object


22
23
24
# File 'lib/onebox.rb', line 22

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