Skip to content
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
122 lines (119 sloc) 8.88 KB

Productive Ruby Snippets Cheat Sheet

Trigger Description
!ruby Ruby Shebang
### Comment Section [X]
& Symbol To Proc
?: Ternary Operator
Name Insert Camelized Filename
aa Attribute Accessor (Read + Write)
alias Define Alias
ar Attribute Reader
ascii ASCII Source Encoding
aw Attribute Writer
begin Begin / Rescue Statement [X]
begine Begin / Rescue / Ensure Statement [X]
binary Binary Source Encoding
callee Special __callee__ Method
case Case Statement
case0 Case Statement as If Alternative
catch Catch and Throw Flow
class Class Definition
class<< Open Singleton Class [X]
classinclude Class Definition (Include)
classinherit Class Definition (Sub-Class)
d64 Decode Base64
def Method Definition with Arguments [X]
def0 Method Definition without Arguments [X]
defi Method Definition (Inline)
defined Defined? Check
defo Method Definition on Object with Arguments [X]
defo0 Method Definition on Object without Arguments [X]
defoi Method Definition on Object (Inline)
defs Method Definition on self with Arguments [X]
defs0 Method Definition on self without Arguments [X]
defsi Method Definition on self (Inline)
dir Special __dir__ Method
do Do Block with Arguments [X]
do0 Do Block without Arguments [X]
e64 Encode Base64
else Else Statement
elsif Elsif Statement
encoding Special __ENCODING__ Statement
ensure Ensure Statement
error New Custom Error
exception New Custom Error (Exception)
extend Extend Method
file Special __FILE__ Statement
frozen Enable Frozen Strings
gem Bundler Gem Line
gemfile Basic Gemfile Template
gemfilegemspec Basic Gemfile Template for Gems
gemgit Bundler Gem Line with Git Option
gemgitbranch Bundler Gem Line with Git Option (Branch)
gemgittag Bundler Gem Line with Git Option (Tag)
gemspec Basic Gemspec Template
group Bundler Group [X]
hashproc New Hash with Default Proc
here Heredoc with Interpolation [X]
here' Heredoc without Interpolation [X]
if If Statement [X]
ife If Statement with Else Clause [X]
include Include Method
init Initialize Method with Arguments
init0 Initialize without Arguments
initi Initialize Method (Inline)
ips Stdlib IPS Benchmark
ivg Instance Variable Getter
ivs Instance Variable Setter
lambda Create Lambda with Arguments [X]
lambda0 Create Lambda without Arguments [X]
lambda0i Create Lambda without Arguments (Inline)
lambdai Create Lambda with Arguments (Inline)
ld Load Method
line Special __LINE__ Statement
loop Loop Block with StopIteration Call
method Special __method__ Method
minispec Basic Minitest Spec Template
module Module Definition
moduleextended Module Definition with Extended Hook
moduleincluded Module Definition with Included Hook
multicomment Multi-line Comment [X]
open3 Pipe Open
prepend Prepend Method
proc Proc with Arguments [X]
proc0 Proc without Arguments [X]
proc0i Proc without Arguments (Inline)
proci Proc with Arguments (Inline)
rakefile Basic Rakefile Template for Gems
random Random Number
randombase64 Random Number Base64
randombytes Random Bytes
randomhex Random Number Hexadecimal
randomurlsafebase64 Random URL Safe Base64
range Range (Inclusive)
rangee Range (Exclusive)
regex Regex
regexi Regex with i Option
regexm Regex with m Option
regexx Regex with x Option
rescue Rescue Statement
rq Require
rr Require Relative
set Set
sha256 SHA 256 Hash Sum
sha512 SHA 512 Hash Sum
struct Struct
task Rake Task [X]
timeout Stdlib Timeout [X]
undef Undefine a Method
unfrozen Disable Frozen Strings
unless Unless Statement [X]
until Until Statement [X]
utf UTF-8 Source Encoding
uuid Random Type4 UUID
version Version Constant Definition
when When Statement
while While Statement [X]
{ {} Block [X]

[X] == wrappable around current selection

You can’t perform that action at this time.