Skip to content
Browse files

Merge pull request #19 from whatcould/master

Add command to convert 1.8 hash syntax into new alternate (hashrocket-free) syntax
  • Loading branch information...
2 parents db93f16 + 9eeac41 commit b6a4c65a154445b2a609be7e3772daf7b4c734ef @JEG2 JEG2 committed Oct 11, 2011
Showing with 30 additions and 0 deletions.
  1. +29 −0 Commands/Convert Ruby hash to 1_9 syntax.tmCommand
  2. +1 −0 info.plist
View
29 Commands/Convert Ruby hash to 1_9 syntax.tmCommand
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>#!/usr/bin/env ruby
+
+print case str = STDIN.read
+ when /=&gt;/; str.gsub(/:(\w+)[\s]+=&gt;[\s]+/, '\1: ')
+ when /(\w+):/; str.gsub(/(\w+):(\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\([^)]*\)|[^,]+))/, ":\\1 =&gt;\\2")
+ else; str
+end
+</string>
+ <key>fallbackInput</key>
+ <string>line</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>keyEquivalent</key>
+ <string>^=</string>
+ <key>name</key>
+ <string>Toggle Ruby Hash 1.8/1.9 syntax</string>
+ <key>output</key>
+ <string>replaceSelectedText</string>
+ <key>uuid</key>
+ <string>F4EEB2B6-07D8-402F-8FC3-79B7308D2576</string>
+</dict>
+</plist>
View
1 info.plist
@@ -433,6 +433,7 @@
<key>ordering</key>
<array>
<string>35222962-C50D-4D58-A6AE-71E7AD980BE4</string>
+ <string>F4EEB2B6-07D8-402F-8FC3-79B7308D2576</string>
<string>5289EE40-86B8-11D9-A8D4-000A95E13C98</string>
<string>63F3B3B7-CBE2-426B-B551-657733F3868B</string>
<string>1AD6A138-2E89-4D6A-AB3F-416BF9CE968D</string>

0 comments on commit b6a4c65

Please sign in to comment.
Something went wrong with that request. Please try again.