Skip to content

Instantly share code, notes, and snippets.

@davidbegin
Created July 26, 2013 01:25
Show Gist options
  • Save davidbegin/6085299 to your computer and use it in GitHub Desktop.
Save davidbegin/6085299 to your computer and use it in GitHub Desktop.
require 'pry'
require 'debugger'
x = %q[This is a dank video <iframe width="560" height="315" src="//www.youtube.com/embed/dGd9DTTrX4U" frameborder="0" allowfullscreen></iframe>]
array = x.split('<iframe')
array.delete('')
new_hash = {}
array.each do |str|
if str.end_with?("</iframe>")
new_string = "<iframe" + str
new_hash.merge!(:iframe => new_string)
else
new_hash.merge!(:text => str)
end
end
debugger
binding pry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment