forked from zufuliu/notepad4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ruby.rb
590 lines (527 loc) · 12 KB
/
Ruby.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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
# Ruby 3.3 https://www.ruby-lang.org/en/documentation/
# https://docs.ruby-lang.org/en/
# https://ruby-doc.org/
# https://rubyreferences.github.io/
#! Keywords ===========================================================
# keywords_rdoc.html
__ENCODING__
__LINE__
__FILE__
BEGIN
END
alias and
break
defined?
else elsif ensure
false
in
next nil not
or
redo rescue retry return
self super
then true
undef
when
yield
# https://bugs.ruby-lang.org/issues/18980
it
#! Pre-defined constants ===================================================
# globals_rdoc.html#label-Pre-defined+global+constants
TRUE
FALSE
NIL
STDIN
STDOUT
STDERR
ENV
ARGF
ARGV
DATA
TOPLEVEL_BINDING
RUBY_VERSION
RUBY_RELEASE_DATE
RUBY_PLATFORM
RUBY_REVISION
RUBY_COPYRIGHT
RUBY_ENGINE
RUBY_ENGINE_VERSION
RUBY_DESCRIPTION
SCRIPT_LINES__
#! code folding ===========================================================
begin
end
case
end
class end
end
def end
end
do
end
for
end
if
end
module end
end
unless
end
until
end
while
end
#! Pre-defined variables ===================================================
# globals_rdoc.html
$DEBUG
$LOAD_PATH
$LOADED_FEATURES
$FILENAME
$stderr
$stdin
$stdout
$VERBOSE
#! regex ===========================================================
# regex can follow keywords
and begin break case do else elsif if next not or return unless until when
end end end
#! built-in ===========================================================
module Kernel
def Array(arg) = object or new_array
def Complex(x[, y], exception: true) = numeric or nil
def Float(arg, exception: true) = float or nil
def Hash(arg) = object or new_hash
def Integer(arg, base=0, exception: true) = integer or nil
def Rational(arg, exception: true) = rational or nil
def String(arg) = object or new_string
def __callee__ = symbol
def __dir__ = string
def __method__ = symbol
def abort([msg]) =
def at_exit = proc
def autoload(const, filename) = nil
def autoload?(name, inherit=true) = String or nil
def binding = a_binding
def block_given? = true or false
def callcc = obj
def caller(range) = array or nil
def caller_locations(range) = array or nil
def catch([tag]) = obj
def chomp(string) = $_
def chop = $_
def clone(freeze: nil) = an_object
def eval(string [, binding [, filename [,lineno]]]) = obj
def exec([env,] command... [,options]) =
def exit(status=true) =
def exit!(status=false) =
def fail(exception [, string [, array]], cause: $!) =
def fork = integer or nil
def format(*args) = string
def frozen? = true or false
def gets(sep, limit [, getline_args]) = string or nil
def global_variables = array
def gsub(pattern, replacement) = $_
def lambda = a_proc
def load(filename, wrap=false) = true
def local_variables = array
def loop = an_enumerator
def open(path [, mode [, perm]] [, opt]) = io or nil
def print(*objects) = nil
def printf(io, format_string, *objects) = nil
def proc = a_proc
def putc(int) = int
def puts(*objects) = nil
def raise(exception [, string [, array]], cause: $!) =
def rand(max=0) = number
def readline(sep, limit, chomp: false) = string
def readlines(sep, limit, chomp: false, **enc_opts) = array
def require(name) = true or false
def require_relative(string) = true or false
def select(read_ios, write_ios = [], error_ios = [], timeout = nil) = array or nil
def set_trace_func(proc) = proc
def sleep([duration]) = integer
def spawn([env,] command... [,options]) = pid
def sprintf(format_string *objects) = string
def srand(number = Random.new_seed) = old_seed
def sub(pattern, replacement) = $_
def syscall(integer_callno, *arguments) = integer
def system([env,] command... [,options], exception: false) = true, false or nil
def tap = obj
def test(cmd, file1 [, file2]) = obj
def then = an_object
def throw(tag [, obj]) =
def trace_var(symbol, cmd) = nil
def trap(signal, command) = obj
def untrace_var(symbol [, cmd]) = array or nil
def warn(*msgs, uplevel: nil, category: nil) = nil
def yield_self = an_object
end
class BasicObject
def new =
def __id__ = integer
def object_id = integer
def send(symbol [, args...]) = obj
def __send__(symbol [, args...]) = obj
def equal?(other) = true or false
def instance_eval(string [, filename [, lineno]]) = obj
def instance_exec(arg...) = obj
def method_missing(symbol [, *args]) = result
def singleton_method_added(symbol) =
def singleton_method_removed(symbol) =
def singleton_method_undefined(symbol) =
end
class Object < BasicObject
def define_singleton_method(symbol, method) = symbol
def display(port=$>) = nil
def dup = an_object
def enum_for(method = :each, *args) = enum
def equal?(other) = true or false
def extend(module_, ...) = obj
def freeze = obj
def hash = integer
def inspect = string
def instance_of?(class_) = true or false
def instance_variable_defined?(symbol) = true or false
def instance_variable_get(symbol) = obj
def instance_variable_set(symbol, obj) = obj
def instance_variables = array
def is_a?(class_) = true or false
def itself = obj
def kind_of?(class_) = true or false
def method(sym) = method
def methods(regular=true) = array
def nil? = true or false
def private_methods(all=true) = array
def protected_methods(all=true) = array
def public_method(sym) = method
def public_methods(all=true) = array
def public_send(symbol [, args...]) = obj
def remove_instance_variable(symbol) = obj
def respond_to?(symbol, include_all=false) = true or false
def respond_to_missing?(symbol, include_all) = true or false
def singleton_class = class_
def singleton_method(sym) = method
def singleton_methods(all=true) = array
def to_enum(method = :each, *args) = enum
def to_s = string
end
class Module
def constants = array
def constants(inherited) = array
def nesting = array
def new = mod
def used_modules = array
def used_refinements = array
def alias_method(new_name, old_name) = symbol
def ancestors = array
def attr(name, ...) = array
def attr_accessor(symbol, ...) = array
def attr_reader(symbol, ...) = array
def attr_writer(symbol, ...) = array
def autoload(const, filename) = nil
def autoload?(name, inherit=true) = String or nil
def class_eval(string [, filename [, lineno]]) = obj
def class_exec(arg...) = obj
def class_variable_defined?(symbol) = true or false
def class_variable_get(symbol) = obj
def class_variable_set(symbol, obj) = obj
def class_variables(inherit=true) = array
def const_defined?(sym, inherit=true) = true or false
def const_get(sym, inherit=true) = obj
def const_missing(sym) = obj
def const_set(sym, obj) = obj
def const_source_location(sym, inherit=true) = [String, Integer]
def constants(inherit=true) = array
def define_method(symbol, method) = symbol
def deprecate_constant(symbol, ...) => mod
def freeze = mod
def include(module_, ...) = self
def include?(module_) = true or false
def included_modules = array
def inspect() =
def instance_method(symbol) = unbound_method
def instance_methods(include_super=true) = array
def method_defined?(symbol, inherit=true) = true or false
def module_eval(string [, filename [, lineno]]) = obj
def module_exec(arg...) = obj
def name = string
def prepend(module_, ...) = self
def private_class_method(symbol, ...) = mod
def private_constant(symbol, ...) => mod
def private_instance_methods(include_super=true) = array
def private_method_defined?(symbol, inherit=true) = true or false
def protected_instance_methods(include_super=true) = array
def protected_method_defined?(symbol, inherit=true) = true or false
def public_class_method(symbol, ...) = mod
def public_constant(symbol, ...) => mod
def public_instance_method(symbol) = unbound_method
def public_instance_methods(include_super=true) = array
def public_method_defined?(symbol, inherit=true) = true or false
def refinements = array
def remove_class_variable(sym) = obj
def remove_method(symbol) = self
def singleton_class? = true or false
def to_s = string
def undef_method(symbol) = self
def undefined_instance_methods = array
def append_features(mod) = mod
def const_added(const_name) =
def extend_object(obj) = obj
def extended(othermod) =
def included(othermod) =
def method_added(method_name) =
def method_removed(method_name) =
def method_undefined(method_name) =
def module_function(method_name, method_name, ...) = array
def prepend_features(mod) = mod
def prepended(othermod) =
def private = nil
def private(method_name, method_name, ...) = array
def protected = nil
def protected(method_name, method_name, ...) = array
def public = nil
def public(method_name, method_name, ...) = array
def refine(mod) = module_
def remove_const(sym) = obj
def ruby2_keywords(method_name, ...) = nil
def using(module_) = self
class Refinement < Module
def import_methods(module_, ...) = self
def refined_class =
end
end
#! core ===========================================================
class ARGF
end
class Array
end
class Binding
end
class Class
end
module Comparable
end
module Continuation
end
class Dir
end
class ENV
end
class Encoding
class EncodingError < StandardError
class CompatibilityError end
class ConverterNotFoundError end
class InvalidByteSequenceError end
class UndefinedConversionError end
end
class Converter
end
end
module Enumerable
end
class Enumerator
class ArithmeticSequence
end
class Chain
end
class Generator
end
class Lazy
end
class Producer
end
class Yielder
end
end
module Errno
end
class Exception
class NoMemoryError end
class ScriptError
class LoadError end
class NotImplementedError end
class SyntaxError end
end
class SecurityError end
class StandardError
class ArgumentError
class UncaughtThrowError end
end
class FiberError end
class IOError
class EOFError end
end
class IndexError
class KeyError
end
class StopIteration
class ClosedQueueError
end
end
end
class LocalJumpError end
class NameError
class NoMethodError end
end
class NoMatchingPatternError
class NoMatchingPatternKeyError end
end
class RangeError
class FloatDomainError end
end
class RuntimeError
class FrozenError end
end
class SystemCallError end
class ThreadError end
class TypeError end
class ZeroDivisionError end
end
class SystemExit end
class SystemStackError end
class SignalException
class Interrupt end
end
end
class FalseClass
end
class Fiber
class Scheduler
end
end
class File < IO
module Constants
end
class Stat
end
end
module FileUtils
end
module GC
module Profiler
end
end
class IO
class Buffer
class AccessError end
class AllocationError end
class InvalidatedError end
class LockedError end
class MaskError end
end
class TimeoutError end
module WaitReadable
class EAGAINWaitReadable end
class EINPROGRESSWaitReadable end
class EWOULDBLOCKWaitReadable end
end
module WaitWritable
class EAGAINWaitWritable end
class EINPROGRESSWaitWritable end
class EWOULDBLOCKWaitWritable end
end
end
class Hash
end
module Marshal
end
class MatchData
end
module Math
class DomainError < StandardError end
end
class Method
end
class NilClass
end
class Numeric
class Complex
end
class Float
end
class Integer
end
class Rational
end
end
module ObjectSpace
class WeakMap
end
end
class Proc
end
class Pool < Fiber
end
module Process
module GID
end
class Status
end
module Sys
end
module UID
end
end
class Ractor
class ClosedError < StopIteration end
class Error < RuntimeError
class IsolationError end
class MovedError end
class RemoteError end
class UnsafeError end
end
class MovedObject < BasicObject
end
end
class Random
module Formatter
end
end
class Range
end
class Ripper
end
class RubyVM
module AbstractSyntaxTree
class Node
end
end
class InstructionSequence
end
end
module Signal
end
class String
end
class Struct
end
class Symbol
end
class Thread
class Backtrace
class Location
end
end
class ConditionVariable
end
class Mutex
end
class Queue
end
class SizedQueue
end
end
class ThreadGroup
end
class Time
end
class TracePoint
end
class TrueClass
end
class UnboundMethod
end
module UnicodeNormalize
end
module Warning
end
#! library ===========================================================