Sha256: 112fc15c3149b63a05001dcd347e0eb69c6a4585fff99033cb0ece06c0c522da
Contents?: true
Size: 737 Bytes
Versions: 8
Compression:
Stored size: 737 Bytes
Contents
# This is broken, document.write is only allowed on load # See: http://stackoverflow.com/questions/9154026/jquery-dynamically-load-a-gist-embed module Onebox module Engine class GithubGistOnebox include Engine matches do http with("gist.") domain("github") tld("com") end def url "https://api.github.com/gists/#{match[:sha]}" end def to_html "<script src=\"//gist.github.com/#{match[:sha]}.js\"></script>" end private def data { sha: match[:sha], title: match[:sha], link: @url } end def match @match ||= @url.match(%r{gist\.github\.com/([^/]+/)?(?<sha>[0-9a-f]+)}) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems