Created
October 27, 2010 02:24
-
-
Save arzumy/648281 to your computer and use it in GitHub Desktop.
Textmate Command to Change HTML Attributes to Ruby Options
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
#!/usr/bin/env ruby | |
def to_options(str) | |
str.gsub(/((\s|^)(\w+))(=)/i) {|v| ", :#{$3} #{$4}> "} | |
end | |
print to_options(STDIN.read) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment