-
Notifications
You must be signed in to change notification settings - Fork 1
/
sample.rb
executable file
·275 lines (226 loc) · 3.51 KB
/
sample.rb
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
#!/usr/bin/env ruby
# dog When writing indent rules, you can use ‘-check-indent’ to
# check if your indentation is correct. To debug what went wrong, set
# ‘treesit--indent-verbose’ to non-nil. Then when you indent, Emacs
# tells you which rule is applied in the echo area.
class Happy
module Doggy
def daft
foo = bar
end
def Doggy.doggy
@frog = banana
end
def (18+12)::house
@banana
end
end
end
begin
if true
dog = 12
end
end
j = /abcd/ixg
$global = 12 * $dog
blah99 = ENV
dog = $!
cat = $@
frog = $5
regexp = /abc(hed|sdf)\tmore/
%r{bl\tahblah blah}
egg = :dog + frog
fred = 2
dog = while fred <
12
puts 'hi'
fred *= 4
fred
end
puts dog.inspect
foo.bar do |z|
dog = 12
end
some_variable = 4 +
some_array.
duck.
reduce do |acc, x|
acc + x
end
foo.
bar.
dog.
house do |z|
dog = 12
cat = 44
end
@dog = 12;
"This is a #{golf}"
alpha, beta, gamma = [ 1, 2, 3]
def frog =
puts("hello world")
echo dog
string = "some \a \r \n \xad\222\"string"
dog = while fred > 12 do
fred *= 4
end
with_paren = (a + b *
c * d +
12)
without_paren = a + b *
c * d +
12
'string'
"string"
%q{some words here}
%{some words here}
%Q{some words here}
%w{some words here}
%W{some words here}
%i{some words here}
%I{some words here}
%r{some words here}
%s{some words here}
%x{some words here}
:"happy dog"
:'happy'
call_me("today",
"tomorrow")
if 12 * 18 +
45 - 19
frog = 12
hat = 12
elsif banana !=
bread
golf = mistake
else
frog = 99
hat = 18
end
if dog
array = [145,
21110,
11]
end
if dog
array = [
145,
21110,
11
]
end
new_hash = {
long_ugly_name: 9,
frog: 12,
daft: 92,
egg: 99
}
hazy = 99 if europe != asia
hazy /= 12 while hazy > 99
while dog < fred
dog += 12
end
until fred > dog do
fred *= 1.2
next if friday
end
for value in [1, 2, 3] do
redo if ambivalent
puts value
break
end
class HaveNoClass
end
class MyClass < HaveNoClass
ConstAssign = 12
def sample(arg2, *args, **rest, &proc)
puts "12"
end
# dog has flees
def blob(arg12,
arg2, # bob
xxx,
yyy
)
case life
when "hard",
"shop",
"hot"
play("victim")
when /abcd/,
/efgh/
buy("twitter",
"friday"
)
end
happy = 99
puts i
end
end
def blah
if false
dog = false
frog do |p, g|
dog = false
dog = false
end
elsif dog !=
cat
dog = false
dog = false
dog = false
else
dog = true
dog = true
dog = true
end
klog do |arg|
blah = false
blah = false
blah = false
blah = false
end
klog { |arg, arg, arg|
blah = false
blah = false
blah = false
blah = false
}
until frog
africa = black
end
while true do
dog = 12
dog = 12
dog = 12
dog = 12
dog = 12
end
if god != satin
sin += 12
egypt = 92
egypt = 92
egypt = 92
egypt = 92
elsif true
dog = 99
dog = 99
dog = 99
dog = 99
else
golf -= 18
golf -= 18
golf -= 18
golf -= 18
end
unless bismark
sink += 12
else
dog = 99
end
i = 12
while i < 44
i += 2
end
end
# and another comment