Gray Soft / Tools of the Trade / Ruby Idioms Bundle for TextMatetag:graysoftinc.com,2014-03-20:/posts/142014-03-28T23:06:33ZJames Edward Gray IIThe 7th Comment on "Ruby Idioms Bundle for TextMate"tag:graysoftinc.com,2008-01-09:/comments/1662014-03-28T23:06:33ZYes, I just leave this post around for historical reference. The bundle is now the official Ruby bundle included with TextMate.
You can find help for deleting the bundle [on the official site](http://wiki.macromates.com/Troubleshooting/RevertT...<p>Yes, I just leave this post around for historical reference. The bundle is now the official Ruby bundle included with TextMate.</p>
<p>You can find help for deleting the bundle <a href="http://wiki.macromates.com/Troubleshooting/RevertToDefaultBundles">on the official site</a>.</p>James Edward Gray IIThe 6th Comment on "Ruby Idioms Bundle for TextMate"tag:graysoftinc.com,2008-01-09:/comments/1652014-03-28T23:03:40Z OK. I should have read more carefully. This was the beginning of the Ruby bundle that I have.
My bad!!
I disavow previous message and will deny it&#39;s existence.<p>OK. I should have read more carefully. This was the beginning of the Ruby bundle that I have.<br>
My bad!! <br>
I disavow previous message and will deny it's existence.</p>Carlton MIllsThe 5th Comment on "Ruby Idioms Bundle for TextMate"tag:graysoftinc.com,2008-01-09:/comments/1642014-03-28T23:06:33Z I am a TextMate newbie. Has this stuff been added to the regular TextMate distribution (I purchased TextMate 2 months ago)?
I downloaded the file and double clicked. TextMate has installed it, but I think I should remove it and I don&#39;t know ho...<p>I am a TextMate newbie. Has this stuff been added to the regular TextMate distribution (I purchased TextMate 2 months ago)? <br>
I downloaded the file and double clicked. TextMate has installed it, but I think I should remove it and I don't know how.</p>
<p>I have been using the Ruby and Rspec boundle with out any problems - other than I don't know what I am doing yet.</p>
<p>I enjoy your blog and use your book. I can't find out whether is OK to just remove the Ruby Idioms.tmbundle file from the application support/TextMate/... directory.</p>
<p>Thank you,<br>
Carlton Mills,<br>
Urbana, Illinois (birthplace of HAL)</p>Carlton MillsThe 4th Comment on "Ruby Idioms Bundle for TextMate"tag:graysoftinc.com,2006-04-27:/comments/392014-03-28T23:02:33ZDave B: Allan tells me this is normal TextMate behavior.<p>Dave B: Allan tells me this is normal TextMate behavior.</p>James Edward Gray IIThe 3rd Comment on "Ruby Idioms Bundle for TextMate"tag:graysoftinc.com,2006-04-26:/comments/382014-03-28T23:02:33ZThanks the efforts to put this bundle out there.
I checked out the TextMate svn and while browsing the code found several references to your home directory in the bundlePath key. (grep bundlePath Macros/*.plist) I don&#39;t know enough TextMate to kn...<p>Thanks the efforts to put this bundle out there.</p>
<p>I checked out the TextMate svn and while browsing the code found several references to your home directory in the bundlePath key. (grep bundlePath Macros/*.plist) I don't know enough TextMate to know whether that's a problem. Just thought I'd point it out. </p>Dave BThe 2nd Comment on "Ruby Idioms Bundle for TextMate"tag:graysoftinc.com,2006-04-15:/comments/262014-03-27T01:38:23ZGreat bundle, extremely helpful, thanks!<p>Great bundle, extremely helpful, thanks!</p>Jon BaerThe 1st Comment on "Ruby Idioms Bundle for TextMate"tag:graysoftinc.com,2006-04-13:/comments/252014-03-27T01:38:23ZSweet.<p>Sweet.</p>thomas AylottRuby Idioms Bundle for TextMatetag:graysoftinc.com,2006-04-12:/posts/142014-03-28T23:06:33ZThis article is the beginning of the effort that later became the official Ruby bundle for TextMate.<p><em>[<strong>Update</strong>: An improved version of Ruby Idioms has been merged into the Ruby bundle in TextMate. Everyone gets Ruby Idioms with TextMate now.]</em></p>
<p>If you are a TextMate user (a Mac OS X text editor), we have something in common and you might be interested in the rest of this post. If not, skip it.</p>
<p>I have made my <a href="https://github.com/textmate/ruby.tmbundle">Ruby Idioms</a> bundle available for anyone who would like to download it and try it out. This bundle contains all the Ruby shortcuts I use to program everyday. I've spent a lot of energy over the last six months refining them down to the keystroke, so hopefully there is a lot of value hidden in there.</p>
<p>If you just want to get to the goods and start playing, click the above link and run. However, if you want some insight into my thinking with these shortcuts, read on…</p>
<h4>Tab Triggers</h4>
<p>I'm a Unix guy, so I'm very comfortable with two or three letter triggers and that's what you are going to find here. Sometimes I use a one or two caracter trigger (r, w, and rw just make sense for <code>attr_reader</code>, <code>attr_writer</code>, and <code>attr_accessor</code>, for example), but three is the norm.</p>
<p>I mention this because it is not the TextMate style and may be a turn off to some.</p>
<h4>Iterators</h4>
<p><strong>All</strong> the core and many standard iterators are included in this bundle. I do mine differently from the normal TextMate style though, so I better mention that too. I find myself skipping around the object when it is included in the block more often than not (and I know where the escape key is when I do need the object), so I just want an empty block that leaves the snippet when I enter it (in case I need new triggers). That's my style.</p>
<h4>Tests</h4>
<p>I've included a compete set of test snippets in this bundle. It duplicates some work in the Rails bundle, but my opinion is that those tests are misplaced there anyway.</p>
<h4>Automatic Requires</h4>
<p>Some of my macros are really just snippets that ensure you have the proper require statement for the code. This can cause TextMate to flash the syntax highlighting because I have to replace all the code up to the cursor. If you would like to use the snippet, without the magic requires, just add a <code>-</code> to the end of the tab trigger.</p>
<p>I use magic requires only where they make sense. For example, <code>def_delegator</code> doesn't need one, because it's <code>extend Forwardable</code>'s job to handle that.</p>
<h4>Idioms</h4>
<p>You will find some imaginary methods as snippet names, like <code>map_with_index</code> and <code>flatten_once</code>. I use them because they are easy to remember names for more complicated idioms. I feel this is more natural, but some may be surprised when the inserted code doesn't look like the snippet title. Don't lose too much sleep over it, I say.</p>
<h4>That Personal Touch</h4>
<p>I wasn't kidding when I said these shortcuts are tuned to the keystroke. I've refined them after a lot of actual usage for what works best for me. You'll notice that extra tab stop in <code>unix_filter</code> I leave in just to activate paragraph mode when I need it and that deleting <code>OTHER_ARGS</code> in the option parsing code also removes the extra space. There are larger scale preferences too, of course. <code>assert</code> needs a failure message, because it could be anything, but <code>assert_equal</code> does not because the failure message makes sense from the method itself.</p>
<p>If you think like I do or can at least get into the flow, this should become pretty comfortable to work with. If not, it may just become a hellish set of magic rules you can't understand or remember. If the lattar is true, you may have to resort to you own bundle of tricks, but perhaps this will at least give you some ideas.</p>James Edward Gray II