chezmoi/private_dot_config/nvim/snippets/ruby.json

109 lines
1.7 KiB
JSON

{
"Method": {
"prefix": "def",
"body": [
"def $1($2)",
" $3",
"end"
],
"description": "Ruby method"
},
"Class": {
"prefix": "class",
"body": [
"class $1",
" def initialize($2)",
" $3",
" end",
"",
" $4",
"end"
],
"description": "Ruby class"
},
"Each loop": {
"prefix": "each",
"body": [
"$1.each do |$2|",
" $3",
"end"
],
"description": "Ruby each loop"
},
"Each with index": {
"prefix": "eachi",
"body": [
"$1.each_with_index do |$2, $3|",
" $4",
"end"
],
"description": "Ruby each with index"
},
"Map": {
"prefix": "map",
"body": [
"$1.map do |$2|",
" $3",
"end"
],
"description": "Ruby map"
},
"Select": {
"prefix": "select",
"body": [
"$1.select do |$2|",
" $3",
"end"
],
"description": "Ruby select"
},
"If statement": {
"prefix": "if",
"body": [
"if $1",
" $2",
"end"
],
"description": "Ruby if statement"
},
"Unless": {
"prefix": "unless",
"body": [
"unless $1",
" $2",
"end"
],
"description": "Ruby unless statement"
},
"Case when": {
"prefix": "case",
"body": [
"case $1",
"when $2",
" $3",
"else",
" $4",
"end"
],
"description": "Ruby case when"
},
"Module": {
"prefix": "module",
"body": [
"module $1",
" $2",
"end"
],
"description": "Ruby module"
},
"Puts": {
"prefix": "puts",
"body": ["puts $1"],
"description": "Ruby puts"
},
"Print": {
"prefix": "p",
"body": ["p $1"],
"description": "Ruby print"
}
}