sublime-useful-ruby-snippets icon indicating copy to clipboard operation
sublime-useful-ruby-snippets copied to clipboard

Ruby snippets for Sublime Text Editor http://www.sublimetext.com/

Missing Ruby & RSpec Snippets for Sublime Text 2

A.K.A. I'll Never Be Sure Why Sublime Didn't Ship With do...end

Start typing the first few letters, and hit tab to complete!

Install it!

Just clone it into the right folder using

git clone git://github.com/accessd/sublime-useful-ruby-snippets.git

  • Linux: In your Sublime packages directory, probably ~/.config/sublime-text-2/Packages
  • Mac OS X (I'm on 10.7 Lion): ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/.
Fun Fact: you don't have to be in the Ruby folder, because each snippet is scoped to be used in .rb files.

Examples

Block with do:

  ... do
  end

Description rspec block:

  describe "description" do ... end

FactoryGirl create method:

  create(:...)

Complete Inventory

... denotes the cursor position immediately after code insertion.

  before do
    ...
  end
  before { ... }
  create ( :... )
  describe "..." do
  
  end
       do
    ...
  end
  each { |...|  }
  each_pair { |k,v| ... }
  each_pair do |k,v|
    ...
  end
  ...: 
  it { should... }
  let(:...) {  }
  let!(:...) {  }

Ruby snippets for Sublime Text Editor