Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.
/ embedda Public archive
forked from kaspergrubbe/embedda

Easily embed content in a string from Youtube, Vimeo or Soundcloud by writing a simple string

Notifications You must be signed in to change notification settings

zweitag/embedda

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

embedda

Easily embed content in a string from Youtube or Vimeo by writing a simple string

Tests:

Build Status

Install

Add this to your Gemfile:

gem 'embedda'

And remember to bundle

Usage

This gem adds String#embedda to Ruby strings. You use it like this:

[2] pry(main)> "String heheh http://www.youtube.com/watch?v=BVtYSy83XXw yeah".embedda
=> "String heheh <iframe width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/BVtYSy83XXw\" frameborder=\"0\" allowfullscreen></iframe> yeah"

If you need only one of the parsers you can do like this:

[2] pry(main)> "String heheh http://www.youtube.com/watch?v=BVtYSy83XXw yeah".embedda(:filters => :youtube)
=> "String heheh <iframe width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/BVtYSy83XXw\" frameborder=\"0\" allowfullscreen></iframe> yeah"

This is the default behavoir:

[2] pry(main)> "String heheh http://www.youtube.com/watch?v=BVtYSy83XXw yeah".embedda(:filters => [:youtube, :vimeo])
=> "String heheh <iframe width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/BVtYSy83XXw\" frameborder=\"0\" allowfullscreen></iframe> yeah"

You can enforce https URLs (useful on SSL-secured sites):

[2] pry(main)> "String heheh http://www.youtube.com/watch?v=BVtYSy83XXw yeah".embedda(ssl: true)
=> "String heheh <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/BVtYSy83XXw\" frameborder=\"0\" allowfullscreen></iframe> yeah"

Supported embeds

Currently embedda can embed the following formats:

  • Youtube
  • Vimeo
  • Soundcloud

Links

Rubygems: https://rubygems.org/gems/embedda

About

Easily embed content in a string from Youtube, Vimeo or Soundcloud by writing a simple string

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%