-
Notifications
You must be signed in to change notification settings - Fork 0
/
ruby.snippets
109 lines (90 loc) · 1.45 KB
/
ruby.snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
snippet desc "describe block"
describe '${1}' do
${2}${VISUAL}
end${3}
endsnippet
snippet it "it block"
it '${1}' do
${VISUAL}${2}
end${3}
endsnippet
snippet iit "inline it"
it { ${1}${VISUAL} }${2}
endsnippet
snippet before "before block"
before do
${1}${VISUAL}
end${2}
endsnippet
snippet ibefore "inline before block"
before { ${1}${VISUAL} }${2}
endsnippet
snippet do "do block" ims
do${1}
${VISUAL}$0
end
endsnippet
snippet def "def"
def ${1}
${VISUAL}${2}
end$0
endsnippet
snippet ilet "inline let block"
let(:${1}) { ${2}${VISUAL} }${3}
endsnippet
snippet let "let block"
let(:${1}) do
${2}${VISUAL}
end${3}
endsnippet
snippet p "puts"
puts ${1}
endsnippet
snippet pb "puts box" i
puts "-------------------"
puts ${1}${VISUAL}
puts "-------------------"
endsnippet
snippet class "class"
class ${1:`!p snip.rv = re.sub('_', '', snip.basename.title())`}
${2:${VISUAL}}$0
end
endsnippet
snippet module "module"
module ${1}
${VISUAL}$0
end
endsnippet
snippet init "initialize"
def initialize${1}
${VISUAL}$0
end
endsnippet
snippet begin "begin block"
begin
${VISUAL}$0
end
endsnippet
snippet rescue "rescue statement"
rescue ${1:StandardError}
${VISUAL}$0
endsnippet
snippet if "if"
if ${1}
${VISUAL}$2
end$0
endsnippet
snippet ll "live_loop :)"
live_loop :${1} do
${VISUAL}${2}
end$0
endsnippet
snippet bp "binding.pry"
binding.pry$0
endsnippet
snippet raketask "rake task"
desc '${1}'
task ${2}: :environment do
${VISUAL}${3}
end$0
endsnippet