Skip to content

Instantly share code, notes, and snippets.

@i0rek
Created Jan 19, 2012
Embed
What would you like to do?
Convert ruby 1.8 hash syntax to 1.9 with shell commands.

Convert to new ruby 1.9 Hashsyntax:

Convert :symbol => value to label: value:

find lib spec -type f -exec sed -i '' -E 's/:([_a-z]+)(\ *)=>/\1:/g' {} \;

Convert "string" => value to label: value:

find lib spec -type f -exec sed -i '' -E 's/"([_a-z]+)"(\ *)=>/\1:/g' {} \;

Convert 'string' => value to label: value:

find lib spec -type f -exec sed -i '' -E "s/'([_a-z]+)'(\ *)=>/\1:/g" {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment