-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ruby.snip
103 lines (85 loc) · 1.81 KB
/
ruby.snip
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
snippet binding-pry
abbr binding.pry
require 'pry'
binding.pry
snippet class-method
abbr class << self ...
options head
class << self
${0}
end
snippet refine
abbr refine Klass do ... end
options head
refine ${1:#:CLASS} do
${0}
end
snippet begin
abbr begin ... end
options head
begin
${1:#:code}
rescue
${2:#:code}
end
snippet exception
abbr class Error < StandardError; end
options head
class ${1:NAME} < ${1:StandardError}; end
snippet yard-param
abbr @param [Type] ...
options head
# @param ${1:NAME} [${2:String}] ${3:#:DESC}
snippet yard-return
abbr @return [Type] ...
options head
# @return [${1:String}] ${3:#:DESC}
snippet yard-raise
abbr @raise [Type] ...
options head
# @raise [${1:StandardError}] ${3:#:DESC}
snippet define_method
abbr define_method() do...end
define_method(${1:name}) do
${0}
end
snippet stackprof
options head
require 'stackprof'
StackProf.run(mode: :cpu, out: '${1:stackprof-out}') do
${0}
end
snippet benchmark
options head
require 'benchmark'
Benchmark.bm do |x|
x.report{10000.times{${0}}}
end
snippet tap
options word
tap { |${1:#:arg}| ${0} }
snippet def_node_matcher
options head
def_node_matcher :${1:name}, <<-PATTERN
${0}
PATTERN
snippet def_node_search
options head
def_node_search :${1:name}, <<-PATTERN
${0}
PATTERN
snippet attr_reader
options head
attr_reader :${1:name}
snippet attr_writer
options head
attr_writer :${1:name}
# ------------------------ override default snippets
snippet def
abbr def ... end
def ${1:initialize}
${2:TARGET}
end
snippet require
options head
require '${0}'