summaryrefslogtreecommitdiff
path: root/luasnip_snippets/ruby.json
blob: 6c2463097471c39bdf533258f3546aa8f2a8dc4b (plain)
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
110
111
{
  "#!": {
    "prefix": "#!",
    "description": "#!/usr/bin/env ruby",
    "body": [
      "#!/usr/bin/env ruby",
      "$0"
    ],
    "luasnip": {
      "priority": -50
    }
  },
  "defr": {
    "prefix": "defr",
    "description": "def <name> ... rescue ...",
    "body": [
      "def ${1:function_name}${2:(${3:*args})}",
      "\t$4",
      "rescue",
      "\t$0",
      "end"
    ]
  },
  "For": {
    "prefix": "For",
    "description": "(<from>..<to>).each { |<i>| <block> }",
    "body": "(${1:from}..${2:to}).each { |${3:i}| $0 \\}"
  },
  "until": {
    "prefix": "until",
    "description": "until <expression> ... end",
    "body": [
      "until ${1:expression}",
      "\t$0",
      "end"
    ]
  },
  "Until": {
    "prefix": "Until",
    "description": "begin ... end until <expression>",
    "body": [
      "begin",
      "\t$0",
      "end until ${1:expression}"
    ]
  },
  "while": {
    "prefix": "while",
    "description": "while <expression> ... end",
    "body": [
      "while ${1:expression}",
      "\t$0",
      "end"
    ]
  },
  "While": {
    "prefix": "While",
    "description": "begin ... end while <expression>",
    "body": [
      "begin",
      "\t$0",
      "end while ${1:expression}"
    ]
  },
  "begin": {
    "prefix": "begin",
    "description": "begin ... rescue ... end",
    "body": [
      "begin",
      "\t$1",
      "rescue",
      "\t$0",
      "end"
    ]
  },
  "rescue": {
    "prefix": "rescue",
    "body": [
      "rescue Exception => e",
      "\tputs e.message",
      "\tputs e.backtrace.inspect",
      "\t${0:# Rescue}"
    ]
  },
  "###": {
    "prefix": "###",
    "body": [
      "=begin",
      "\t$0",
      "=end"
    ]
  },
  "priv": {
    "prefix": "priv",
    "description": "private ",
    "body": [
      "private",
      "",
      "$0"
    ]
  },
  "prot": {
    "prefix": "prot",
    "description": "protected",
    "body": [
      "protected",
      "",
      "$0"
    ]
  }
}