Add DiscourseLocalOnebox

This commit is contained in:
Neil Lalonde
2014-01-28 13:18:19 -05:00
parent 30abc6b291
commit d343e9f360
4 changed files with 177 additions and 3 deletions

View File

@ -1,3 +1,8 @@
Dir["#{Rails.root}/lib/onebox/engine/*_onebox.rb"].each {|f|
require_dependency(f.split('/')[-3..-1].join('/'))
}
module Oneboxer
@ -26,14 +31,14 @@ module Oneboxer
Onebox.preview(url, cache: Rails.cache).to_s
end
def self.oneboxer_exists_for_url?(url)
def self.oneboxer_exists_for_url?(url)
Onebox.has_matcher?(url)
end
def self.invalidate(url)
def self.invalidate(url)
Rails.cache.delete(url)
end
# Parse URLs out of HTML, returning the document when finished.
def self.each_onebox_link(string_or_doc)
doc = string_or_doc