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/oembed.rb,
lib/onebox/helpers.rb,
lib/onebox/matcher.rb,
lib/onebox/preview.rb,
lib/onebox/version.rb,
lib/onebox/open_graph.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/pdf_onebox.rb,
lib/onebox/engine/coub_onebox.rb,
lib/onebox/engine/xkcd_onebox.rb,
lib/onebox/mixins/github_body.rb,
lib/onebox/engine/audio_onebox.rb,
lib/onebox/engine/giphy_onebox.rb,
lib/onebox/engine/image_onebox.rb,
lib/onebox/engine/imgur_onebox.rb,
lib/onebox/engine/video_onebox.rb,
lib/onebox/engine/vimeo_onebox.rb,
lib/onebox/engine/youku_onebox.rb,
lib/onebox/engine/amazon_onebox.rb,
lib/onebox/engine/flickr_onebox.rb,
lib/onebox/engine/gfycat_onebox.rb,
lib/onebox/engine/pubmed_onebox.rb,
lib/onebox/engine/replit_onebox.rb,
lib/onebox/engine/slides_onebox.rb,
lib/onebox/engine/trello_onebox.rb,
lib/onebox/engine/wistia_onebox.rb,
lib/onebox/mixins/twitch_onebox.rb,
lib/onebox/engine/kaltura_onebox.rb,
lib/onebox/engine/standard_embed.rb,
lib/onebox/engine/youtube_onebox.rb,
lib/onebox/engine/bandcamp_onebox.rb,
lib/onebox/engine/cloudapp_onebox.rb,
lib/onebox/engine/mixcloud_onebox.rb,
lib/onebox/engine/opengraph_image.rb,
lib/onebox/engine/pastebin_onebox.rb,
lib/onebox/engine/typeform_onebox.rb,
lib/onebox/mixins/git_blob_onebox.rb,
lib/onebox/engine/asciinema_onebox.rb,
lib/onebox/engine/audioboom_onebox.rb,
lib/onebox/engine/instagram_onebox.rb,
lib/onebox/engine/sketchfab_onebox.rb,
lib/onebox/engine/wikimedia_onebox.rb,
lib/onebox/engine/wikipedia_onebox.rb,
lib/onebox/engine/simplecast_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/gitlab_blob_onebox.rb,
lib/onebox/engine/google_docs_onebox.rb,
lib/onebox/engine/google_maps_onebox.rb,
lib/onebox/engine/steam_store_onebox.rb,
lib/onebox/engine/github_issue_onebox.rb,
lib/onebox/engine/google_drive_onebox.rb,
lib/onebox/engine/reddit_media_onebox.rb,
lib/onebox/engine/github_commit_onebox.rb,
lib/onebox/engine/github_folder_onebox.rb,
lib/onebox/engine/google_photos_onebox.rb,
lib/onebox/engine/facebook_media_onebox.rb,
lib/onebox/engine/stack_exchange_onebox.rb,
lib/onebox/engine/twitter_status_onebox.rb,
lib/onebox/engine/five_hundred_px_onebox.rb,
lib/onebox/engine/google_calendar_onebox.rb,
lib/onebox/engine/google_play_app_onebox.rb,
lib/onebox/engine/flickr_shortened_onebox.rb,
lib/onebox/engine/github_pullrequest_onebox.rb,
lib/onebox/engine/allowlisted_generic_onebox.rb
Defined Under Namespace
Modules: Engine, FileTypeFinder, Helpers, LayoutSupport, Mixins, TemplateSupport, WebHelpers
Classes: Layout, Matcher, Oembed, OpenGraph, Preview, StatusCheck, View, Web
Constant Summary
collapse
- DEFAULTS =
{
connect_timeout: 5,
timeout: 10,
max_download_kb: (10 * 1024), load_paths: [File.join(Gem::Specification.find_by_name("onebox").gem_dir, "templates")],
allowed_ports: [80, 443],
allowed_schemes: ["http", "https"],
sanitize_config: Sanitize::Config::ONEBOX,
redirect_limit: 5
}
- VERSION =
"2.2.19"
- @@options =
DEFAULTS
Class Method Summary
collapse
Class Method Details
.check(url, options = Onebox.options) ⇒ Object
.has_matcher?(url) ⇒ Boolean
46
47
48
|
# File 'lib/onebox.rb', line 46
def self.has_matcher?(url)
!!Matcher.new(url).oneboxed
end
|
.options ⇒ Object
42
43
44
|
# File 'lib/onebox.rb', line 42
def self.options
OpenStruct.new(@@options)
end
|
.options=(options) ⇒ Object
50
51
52
|
# File 'lib/onebox.rb', line 50
def self.options=(options)
@@options = DEFAULTS.merge(options)
end
|
.preview(url, options = Onebox.options) ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/onebox.rb', line 29
def self.preview(url, options = Onebox.options)
unless Onebox::Helpers.blank?(options[:cache])
warn "Onebox no longer has inbuilt caching so `cache` option will be ignored."
end
Preview.new(url, options)
end
|