class Onebox::Engine::AsciinemaOnebox

Public Instance Methods

placeholder_html() click to toggle source
# File lib/onebox/engine/asciinema_onebox.rb, line 16
def placeholder_html
  "<img src='https://asciinema.org/a/#{match[:asciinema_id]}.png'>"
end
to_html() click to toggle source
# File lib/onebox/engine/asciinema_onebox.rb, line 12
def to_html
  "<script type='text/javascript' src='https://asciinema.org/a/#{match[:asciinema_id]}.js' id='asciicast-#{match[:asciinema_id]}' async></script>"
end

Private Instance Methods

match() click to toggle source
# File lib/onebox/engine/asciinema_onebox.rb, line 22
def match
  @match ||= @url.match(/asciinema\.org\/a\/(?<asciinema_id>[\p{Alnum}_\-]+)$/)
end