Created
July 26, 2013 01:25
-
-
Save davidbegin/6085299 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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