rdl 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/rails_types.rb +1 -0
- data/lib/rdl.rb +56 -0
- data/lib/rdl/config.rb +121 -0
- data/lib/rdl/contracts/and.rb +29 -0
- data/lib/rdl/contracts/contract.rb +7 -0
- data/lib/rdl/contracts/flat.rb +31 -0
- data/lib/rdl/contracts/or.rb +25 -0
- data/lib/rdl/contracts/proc.rb +24 -0
- data/lib/rdl/switch.rb +20 -0
- data/lib/rdl/types/annotated_arg.rb +41 -0
- data/lib/rdl/types/finitehash.rb +81 -0
- data/lib/rdl/types/generic.rb +100 -0
- data/lib/rdl/types/intersection.rb +66 -0
- data/lib/rdl/types/lexer.rex +39 -0
- data/lib/rdl/types/lexer.rex.rb +148 -0
- data/lib/rdl/types/method.rb +219 -0
- data/lib/rdl/types/nil.rb +50 -0
- data/lib/rdl/types/nominal.rb +80 -0
- data/lib/rdl/types/optional.rb +54 -0
- data/lib/rdl/types/parser.racc +150 -0
- data/lib/rdl/types/parser.tab.rb +654 -0
- data/lib/rdl/types/singleton.rb +62 -0
- data/lib/rdl/types/structural.rb +72 -0
- data/lib/rdl/types/top.rb +50 -0
- data/lib/rdl/types/tuple.rb +61 -0
- data/lib/rdl/types/type.rb +24 -0
- data/lib/rdl/types/type_inferencer.rb +73 -0
- data/lib/rdl/types/union.rb +74 -0
- data/lib/rdl/types/var.rb +51 -0
- data/lib/rdl/types/vararg.rb +54 -0
- data/lib/rdl/types/wild.rb +26 -0
- data/lib/rdl/util.rb +56 -0
- data/lib/rdl/wrap.rb +505 -0
- data/lib/rdl_types.rb +2 -0
- data/types/other/chronic.rb +5 -0
- data/types/other/paperclip_attachment.rb +7 -0
- data/types/other/securerandom.rb +4 -0
- data/types/rails-4.2.1/fixnum.rb +3 -0
- data/types/rails-4.2.1/string.rb +3 -0
- data/types/rails-tmp/action_dispatch.rb +406 -0
- data/types/rails-tmp/active_record.rb +406 -0
- data/types/rails-tmp/devise_contracts.rb +216 -0
- data/types/ruby-2.2.0/_aliases.rb +4 -0
- data/types/ruby-2.2.0/abbrev.rb +5 -0
- data/types/ruby-2.2.0/array.rb +137 -0
- data/types/ruby-2.2.0/base64.rb +10 -0
- data/types/ruby-2.2.0/basic_object.rb +13 -0
- data/types/ruby-2.2.0/benchmark.rb +11 -0
- data/types/ruby-2.2.0/bigdecimal.rb +15 -0
- data/types/ruby-2.2.0/bigmath.rb +12 -0
- data/types/ruby-2.2.0/class.rb +17 -0
- data/types/ruby-2.2.0/complex.rb +42 -0
- data/types/ruby-2.2.0/coverage.rb +6 -0
- data/types/ruby-2.2.0/csv.rb +5 -0
- data/types/ruby-2.2.0/date.rb +6 -0
- data/types/ruby-2.2.0/dir.rb +38 -0
- data/types/ruby-2.2.0/encoding.rb +23 -0
- data/types/ruby-2.2.0/enumerable.rb +98 -0
- data/types/ruby-2.2.0/enumerator.rb +26 -0
- data/types/ruby-2.2.0/exception.rb +15 -0
- data/types/ruby-2.2.0/file.rb +124 -0
- data/types/ruby-2.2.0/fileutils.rb +6 -0
- data/types/ruby-2.2.0/fixnum.rb +45 -0
- data/types/ruby-2.2.0/float.rb +54 -0
- data/types/ruby-2.2.0/gem.rb +245 -0
- data/types/ruby-2.2.0/hash.rb +72 -0
- data/types/ruby-2.2.0/integer.rb +31 -0
- data/types/ruby-2.2.0/io.rb +103 -0
- data/types/ruby-2.2.0/kernel.rb +89 -0
- data/types/ruby-2.2.0/marshal.rb +5 -0
- data/types/ruby-2.2.0/matchdata.rb +26 -0
- data/types/ruby-2.2.0/math.rb +53 -0
- data/types/ruby-2.2.0/numeric.rb +46 -0
- data/types/ruby-2.2.0/object.rb +73 -0
- data/types/ruby-2.2.0/pathname.rb +106 -0
- data/types/ruby-2.2.0/process.rb +127 -0
- data/types/ruby-2.2.0/random.rb +15 -0
- data/types/ruby-2.2.0/range.rb +38 -0
- data/types/ruby-2.2.0/rational.rb +31 -0
- data/types/ruby-2.2.0/regexp.rb +30 -0
- data/types/ruby-2.2.0/set.rb +58 -0
- data/types/ruby-2.2.0/string.rb +145 -0
- data/types/ruby-2.2.0/strscan.rb +7 -0
- data/types/ruby-2.2.0/symbol.rb +29 -0
- data/types/ruby-2.2.0/time.rb +68 -0
- data/types/ruby-2.2.0/uri.rb +18 -0
- data/types/ruby-2.2.0/yaml.rb +5 -0
- metadata +131 -0
@@ -0,0 +1,89 @@
|
|
1
|
+
module Kernel
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
# type 'self.Array', '([to_ary: () -> Array<t>]) -> Array<t>'
|
5
|
+
# type 'self.Array', '([to_a: () -> Array<t>]) -> Array<t>'
|
6
|
+
type 'self.Complex', '(Numeric x, Numeric y) -> Complex'
|
7
|
+
type 'self.Complex', '(String x) -> Complex'
|
8
|
+
type 'self.Float', '(Numeric x) -> Float'
|
9
|
+
# type 'self.Float', '(x : [to_f : () -> Float]) -> Float'
|
10
|
+
# type 'self.Hash', '(x : [to_hash : () -> Hash<k,v>]) -> Hash<k,v>'
|
11
|
+
type 'self.Hash', '(nil x) -> Hash<k,v>'
|
12
|
+
# type 'self.Hash, '(x : []) -> Hash<k,v>'
|
13
|
+
type 'self.Integer', '(Numeric or String arg, ?Fixnum base) -> Integer'
|
14
|
+
# type 'self.Integer', '(arg : [to_int : () -> Integer], base : ?Fixnum) -> Integer'
|
15
|
+
# type 'self.Integer', '(arg : [to_i : () -> Integer], base : ?Fixnum) -> Integer'
|
16
|
+
type 'self.Rational', '(Numeric x, Numeric y) -> Rational'
|
17
|
+
type 'self.Rational', '(String x) -> Rational'
|
18
|
+
# type 'self.String', '(arg : [to_s : () -> String]) -> String'
|
19
|
+
type 'self.__callee__', '() -> Symbol or nil'
|
20
|
+
type 'self.__dir__', '() -> String or nil'
|
21
|
+
type 'self.__method__', '() -> Symbol or nil'
|
22
|
+
type 'self.`', '(String) -> String'
|
23
|
+
type 'self.abort', '(?String msg) -> %any'
|
24
|
+
type 'self.at_exit', '() { () -> %any} -> Proc' # TODO: Fix proc
|
25
|
+
type 'self.autoload', '(String or Symbol module, String filename) -> nil'
|
26
|
+
type 'self.autoload?', '(Symbol or String name) -> String or nil'
|
27
|
+
type 'self.binding', '() -> Binding'
|
28
|
+
type 'self.block_given?', '() -> %bool'
|
29
|
+
type 'self.caller', '(?Fixnum start, ?Fixnum length) -> Array<String> or nil'
|
30
|
+
type 'self.caller', '(Range) -> Array<String> or nil'
|
31
|
+
type 'self.caller_locations', '(?Fixnum start, ?Fixnum length) -> Array<String> or nil'
|
32
|
+
type 'self.caller_locations', '(Range) -> Array<String> or nil'
|
33
|
+
# type 'self.catch' # TODO
|
34
|
+
type 'self.eval', '(String, ?Binding, ?String filename, ?Fixnum lineno) -> %any'
|
35
|
+
# type 'self.exec' #TODO
|
36
|
+
type 'self.exit', '(Fixnum or %bool status) -> %any'
|
37
|
+
type 'self.exit!', '(Fixnum or %bool status) -> %any'
|
38
|
+
type 'self.fail', '() -> %any'
|
39
|
+
type 'self.fail', '(String) -> %any'
|
40
|
+
type 'self.fail', '(Class, Array<String>) -> %any'
|
41
|
+
type 'self.fail', '(Class, String, Array<String>) -> %any'
|
42
|
+
# type 'self.fail', '(String or [exception : () -> String], ?String, ?Array<String>) -> %any'
|
43
|
+
# type 'self.fork' #TODO
|
44
|
+
type 'self.format', '(String format, *%any args) -> String'
|
45
|
+
type 'self.gets', '(?String, ?Fixnum) -> String'
|
46
|
+
type 'self.global_variables', '() -> Array<Symbol>'
|
47
|
+
type 'self.iterator?', '() -> %bool'
|
48
|
+
# type 'self.lambda' # TODO
|
49
|
+
type 'self.load', '(String filename, ?%bool) -> %bool'
|
50
|
+
type 'self.local_variables', '() -> Array<Symbol>'
|
51
|
+
# type 'self.loop' #TODO
|
52
|
+
type 'self.open', '(String path, ?(String or Fixnum) mode, ?String perm) -> IO or nil'
|
53
|
+
# type 'self.open', '(String path, mode : ?String, perm: ?String) {(IO) -> %any)} -> %any' # TODO: returns block value
|
54
|
+
# type 'self.open', '(String path, mode : ?Fixnum, perm: ?String) {(IO) -> %any)} -> %any' # TODO: returns block value
|
55
|
+
# type 'self.p', '(*[inspect : () -> String]) -> nil'
|
56
|
+
# type 'self.print', '(*[to_s : () -> String] -> nil'
|
57
|
+
type 'self.printf', '(?IO, ?String, *%any) -> nil'
|
58
|
+
type(:proc, "() {(*%any) -> %any} -> Proc") # TODO more precise
|
59
|
+
type 'self.putc', '(Fixnum) -> Fixnum'
|
60
|
+
type 'self.puts', '(*[to_s : () -> String]) -> nil'
|
61
|
+
type 'self.raise', '() -> %any'
|
62
|
+
# type 'self.raise', '(String or [exception : () -> String], ?String, ?Array<String>) -> %any'
|
63
|
+
# TODO: above same as fail?
|
64
|
+
type 'self.rand', '(Fixnum or Range max) -> Numeric'
|
65
|
+
type 'self.readline', '(?String, ?Fixnum) -> String'
|
66
|
+
type 'self.readlines', '(?String, ?Fixnum) -> Array<String>'
|
67
|
+
type 'self.require', '(String name) -> %bool'
|
68
|
+
type 'self.require_relative', '(String name) -> %bool'
|
69
|
+
type 'self.select',
|
70
|
+
'(Array<IO> read, ?Array<IO> write, ?Array<IO> error, ?Fixnum timeout) -> Array<String>' # TODO: return type?
|
71
|
+
# type 'self.set_trace_func' #TODO
|
72
|
+
type 'self.sleep', '(Numeric duration) -> Fixnum'
|
73
|
+
# type 'self.spawn' #TODO
|
74
|
+
rdl_alias :sprintf, :format # TODO: are they aliases?
|
75
|
+
type 'self.srand', '(Numeric number) -> Numeric'
|
76
|
+
type 'self.syscall', '(Fixnum num, *%any args) -> %any' # TODO : ?
|
77
|
+
# type 'self.system' # TODO
|
78
|
+
type 'self.test', '(String cmd, String file1, ?String file2) -> %bool or Time' # TODO: better, dependent type?
|
79
|
+
# type 'self.throw' # TODO
|
80
|
+
# type 'self.trace_var' # TODO
|
81
|
+
# type 'self.trap' # TODO
|
82
|
+
# type 'self.untrace_var' # TODO
|
83
|
+
type 'self.warn', '(*String msg) -> nil'
|
84
|
+
type :raise, '() -> nil'
|
85
|
+
type :raise, '(String) -> nil'
|
86
|
+
type :raise, '(Class, String, Array<String>) -> nil'
|
87
|
+
type :send, '(String or Symbol, *%any) -> %any'
|
88
|
+
type :send, '(String or Symbol, *%any) { (*%any) -> %any } -> %any'
|
89
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class MatchData
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
type :==, '(%any) -> %bool'
|
5
|
+
type :[], '(Fixnum i) -> String or nil'
|
6
|
+
type :[], '(Fixnum start, Fixnum length) -> Array<String>'
|
7
|
+
type :[], '(Range<Fixnum> range) -> Array<String>'
|
8
|
+
type :[], '(String or Symbol name) -> String or nil'
|
9
|
+
type :begin, '(Fixnum n) -> Fixnum'
|
10
|
+
type :captures, '() -> Array<String>'
|
11
|
+
type :end, '(Fixnum n) -> Fixnum'
|
12
|
+
type :eql?, '(%any other) -> %bool'
|
13
|
+
type :hash, '() -> Fixnum'
|
14
|
+
type :inspect, '() -> String'
|
15
|
+
type :length, '() -> Fixnum'
|
16
|
+
type :names, '() -> Array<String>'
|
17
|
+
type :offset, '(Fixnum n) -> Array<Fixnum>'
|
18
|
+
type :post_match, '() -> String'
|
19
|
+
type :pre_match, '() -> String'
|
20
|
+
type :regexp, '() -> Regexp'
|
21
|
+
type :size, '() -> Fixnum'
|
22
|
+
type :string, '() -> String'
|
23
|
+
type :to_a, '() -> Array<String>'
|
24
|
+
type :to_s, '() -> String'
|
25
|
+
type :values_at, '(*Fixnum indexes) -> Array<String>'
|
26
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Math
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
type 'self.acos', '(%real x) -> Float'
|
5
|
+
pre('self.acos') { |x| -1 <= x && x <= 1 }
|
6
|
+
post('self.acos') { |r, _| 0 <= r && r <= Math::PI }
|
7
|
+
type 'self.acosh', '(%real x) -> Float'
|
8
|
+
pre('self.acosh') { |x| 1 <= x }
|
9
|
+
post('self.acosh') { |r, _| 0 <= r }
|
10
|
+
type 'self.asin', '(%real x) -> Float'
|
11
|
+
pre('self.asin') { |x| -1 <= x && x <= 1 }
|
12
|
+
post('self.asin') { |r, _| -Math::PI/2 <= r && r <= Math::PI/2 }
|
13
|
+
type 'self.asinh', '(%real x) -> Float'
|
14
|
+
type 'self.atan', '(%real x) -> Float'
|
15
|
+
post('self.atan') { |r, _| -Math::PI/2 <= r && r <= Math::PI/2 }
|
16
|
+
type 'self.atan2', '(%real y, %real x) -> Float'
|
17
|
+
post('self.atan2') { |r, _| -Math::PI <= r && r <= Math::PI }
|
18
|
+
type 'self.atanh', '(%real x) -> Float'
|
19
|
+
pre('self.atanh') { |x| -1 < x && x < 1 }
|
20
|
+
type 'self.cbrt', '(%real x) -> Float'
|
21
|
+
pre('self.cbrt') { |x| 0 <= x }
|
22
|
+
post('self.cbrt') { |x| 0 <= x }
|
23
|
+
type 'self.cos', '(%real x) -> Float'
|
24
|
+
post('self.cos') { |r, _| -1 <= r && r <= 1 }
|
25
|
+
type 'self.cosh', '(%real x) -> Float'
|
26
|
+
post('self.cosh') { |r, _| 1 <= r }
|
27
|
+
type 'self.erf', '(%real x) -> Float'
|
28
|
+
post('self.erf') { |r, _| -1 < r && r < 1 }
|
29
|
+
type 'self.erfc', '(%real x) -> Float'
|
30
|
+
post('self.erfc') { |r, _| 0 < r && r < 2 }
|
31
|
+
type 'self.exp', '(%real x) -> Float'
|
32
|
+
post('self.exp') { |r, _| 0 < r }
|
33
|
+
type 'self.frexp', '(%real x) -> [%real, %real]'
|
34
|
+
type 'self.gamma', '(%real x) -> Float'
|
35
|
+
type 'self.hypot', '(%real x, %real y) -> Float'
|
36
|
+
type 'self.ldexp', '(%real fraction, %real exponent) -> Float'
|
37
|
+
type 'self.lgamma', '(%real x) -> -1 or 1 or Float'
|
38
|
+
type 'self.log', '(%real x, ?(%real) base) -> Float'
|
39
|
+
type 'self.log10', '(%real x) -> Float'
|
40
|
+
pre('self.log10') { |x| 0 < x }
|
41
|
+
type 'self.log2', '(%real x) -> Float'
|
42
|
+
pre('self.log2') { |x| 0 < x }
|
43
|
+
type 'self.sin', '(%real x) -> Float'
|
44
|
+
post('self.sin') { |r, _| -1 <= r && r <= 1 }
|
45
|
+
type 'self.sinh', '(%real x) -> Float'
|
46
|
+
type 'self.sqrt', '(%real x) -> Float'
|
47
|
+
pre('self.sqrt') { |x| 0 <= x }
|
48
|
+
post('self.sqrt') { |r, _| 0 <= r }
|
49
|
+
type 'self.tan', '(%real x) -> Float'
|
50
|
+
type 'self.tanh', '(%real x) -> Float'
|
51
|
+
post('self.tanh') { |r, _| -1 < r && r < 1 }
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class Numeric
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
type :+, '() -> self'
|
5
|
+
type :-, '() -> Numeric'
|
6
|
+
type :<=>, '(Numeric) -> -1 or 0 or 1 or nil'
|
7
|
+
type :abs, '() -> Numeric'
|
8
|
+
type :abs2, '() -> %real'
|
9
|
+
type :angle, '() -> 0 or ${Math::PI}'
|
10
|
+
type :arg, '() -> 0 or ${Math::PI}'
|
11
|
+
type :ceil, '() -> Integer'
|
12
|
+
type :coerce, '(Numeric) -> [Numeric, Numeric]'
|
13
|
+
type :conj, '() -> self'
|
14
|
+
rdl_alias :conjugate, :conj
|
15
|
+
type :denominator, '() -> Integer'
|
16
|
+
post(:denominator) { |r, _| r > 0 }
|
17
|
+
type :div, '(Numeric) -> Integer'
|
18
|
+
type :divmod, '(Numeric) -> [Numeric, Numeric]'
|
19
|
+
type :eql?, '(Numeric) -> %bool'
|
20
|
+
type :fdiv, '(Numeric) -> Float'
|
21
|
+
type :floor, '() -> Integer'
|
22
|
+
type :i, '() -> Complex'
|
23
|
+
type :imag, '() -> 0'
|
24
|
+
rdl_alias :imaginary, :imag
|
25
|
+
# initialize_copy can't be invoked
|
26
|
+
type :integer?, '() -> %bool'
|
27
|
+
type :magnitude, '() -> Numeric'
|
28
|
+
type :modulo, '(Numeric) -> %real'
|
29
|
+
type :nonzero?, '() -> self or nil'
|
30
|
+
type :numerator, '() -> Integer'
|
31
|
+
type :phase, '() -> 0 or ${Math::PI}'
|
32
|
+
type :polar, '() -> [Numeric, Numeric]'
|
33
|
+
type :quo, '(Integer or Rational) -> Rational'
|
34
|
+
type :quo, '(Float) -> Float'
|
35
|
+
type :real, '() -> self'
|
36
|
+
type :rect, '() -> [Numeric, 0]'
|
37
|
+
rdl_alias :rectangular, :rect
|
38
|
+
type :remainder, '(Numeric) -> %real'
|
39
|
+
type :round, '(?Fixnum ndigits) -> Integer or Float'
|
40
|
+
# singleton_method_added can't be invoked
|
41
|
+
# type :step, # TODO: hash args
|
42
|
+
type :to_c, '() -> Complex'
|
43
|
+
type :to_int, '() -> Integer'
|
44
|
+
type :truncate, '() -> Integer'
|
45
|
+
type :zero?, '() -> %bool'
|
46
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
class Object
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
# type :ARGF, ARGF
|
5
|
+
# type :ARGV, 'Array<String>'
|
6
|
+
# type :DATA, 'File'
|
7
|
+
# type :ENV, ENV
|
8
|
+
# type :FALSE, '%false'
|
9
|
+
# type :NIL, 'nil'
|
10
|
+
# type :RUBY_COPYRIGHT, 'String'
|
11
|
+
# type :RUBY_DESCRIPTION, 'String'
|
12
|
+
# type :RUBY_ENGINE, 'String'
|
13
|
+
# type :RUBY_PATCHLEVEL, Fixnum
|
14
|
+
# type :RUBY_PLATFORM, 'String'
|
15
|
+
# type :RUBY_RELEASE_DATE, 'String'
|
16
|
+
# type :RUBY_REVISION, Fixnum
|
17
|
+
# type :RUBY_VERSION, 'String'
|
18
|
+
# type :STDERR, 'IO'
|
19
|
+
# type :STDIN, 'IO'
|
20
|
+
# type :STDOUT, 'IO'
|
21
|
+
# type :TOPLEVEL_BINDING, 'Binding'
|
22
|
+
# type :TRUE, '%true'
|
23
|
+
|
24
|
+
type :!~, '(%any other) -> %bool'
|
25
|
+
type :<=>, '(%any other) -> Fixnum or nil'
|
26
|
+
type :===, '(%any other) -> %bool'
|
27
|
+
type :=~, '(%any other) -> nil'
|
28
|
+
type :class, '() -> Class'
|
29
|
+
type :clone, '() -> %any'
|
30
|
+
# type :define_singleton_method, '(XXXX : *XXXX)') # TODO
|
31
|
+
type :display, '(IO port) -> nil'
|
32
|
+
type :dup, '() -> %any an_object'
|
33
|
+
type :enum_for, '(?Symbol method, *%any args) -> Enumerator<%any>'
|
34
|
+
type :enum_for, '(?Symbol method, *%any args) { (*%any args) -> %any } -> Enumerator<%any>'
|
35
|
+
type :eql?, '(%any other) -> %bool'
|
36
|
+
# type :extend, '(XXXX : *XXXX)') # TODO
|
37
|
+
type :freeze, '() -> self'
|
38
|
+
type :frozen?, '() -> %bool'
|
39
|
+
type :hash, '() -> Fixnum'
|
40
|
+
type :inspect, '() -> String'
|
41
|
+
type :instance_of?, '(Class) -> %bool'
|
42
|
+
type :instance_variable_defined?, '(Symbol or String) -> %bool'
|
43
|
+
type :instance_variable_get, '(Symbol or String) -> %any'
|
44
|
+
type :instance_variable_set, '(Symbol or String, %any) -> %any' # returns 2nd argument
|
45
|
+
type :instance_variables, '() -> Array<Symbol>'
|
46
|
+
type :is_a?, '(Class or Module) -> %bool'
|
47
|
+
type :kind_of?, '(Class) -> %bool'
|
48
|
+
type :method, '(Symbol) -> Method'
|
49
|
+
type :methods, '(?%bool regular) -> Array<Symbol>'
|
50
|
+
type :nil?, '() -> %bool'
|
51
|
+
type :private_methods, '(?%bool all) -> Array<Symbol>'
|
52
|
+
type :protected_methods, '(?%bool all) -> Array<Symbol>'
|
53
|
+
type :public_method, '(Symbol) -> Method'
|
54
|
+
type :public_methods, '(?%bool all) -> Array<Symbol>'
|
55
|
+
type :public_send, '(Symbol or String, *%any args) -> %any'
|
56
|
+
type :remove_instance_variable, '(Symbol) -> %any'
|
57
|
+
# type :respond_to?, '(Symbol or String, ?%bool include_all) -> %bool'
|
58
|
+
# type :send, '(Symbol or String, *%any args) -> %any' # Can't wrap this, used outside wrap switch
|
59
|
+
type :singleton_class, '() -> Class'
|
60
|
+
type :singleton_method, '(Symbol) -> Method'
|
61
|
+
type :singleton_methods, '(?%bool all) -> Array<Symbol>'
|
62
|
+
type :taint, '() -> self'
|
63
|
+
type :tainted?, '() -> %bool'
|
64
|
+
# type :tap, '()') # TODO
|
65
|
+
type :to_enum, '(?Symbol method, *%any args) -> Enumerator<%any>'
|
66
|
+
type :to_enum, '(?Symbol method, *%any args) {(*%any args) -> %any} -> Enumerator<%any>'
|
67
|
+
# TODO: above alias for enum_for?
|
68
|
+
type :to_s, '() -> String'
|
69
|
+
type :trust, '() -> self'
|
70
|
+
type :untaint, '() -> self'
|
71
|
+
type :untrust, '() -> self'
|
72
|
+
type :untrusted?, '() -> %bool'
|
73
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
class Pathname
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
type 'self.getwd', '() -> Pathname'
|
5
|
+
type 'self.glob', '(String p1, ?String p2) -> Array<Pathname>'
|
6
|
+
type 'self.new', '(%string or Pathname p1) -> Pathname' # p1 can be String-like
|
7
|
+
rdl_alias 'self.pwd', 'self.getwd'
|
8
|
+
type :+, '(String or Pathname other) -> Pathname'
|
9
|
+
rdl_alias :/, :+
|
10
|
+
type :<=>, '(%any p1) -> -1 or 0 or 1 or nil'
|
11
|
+
type :==, '(%any p1) -> %bool'
|
12
|
+
type :===, '(%any p1) -> %bool'
|
13
|
+
type :absolute?, '() -> %bool'
|
14
|
+
type :ascend, '() { (Pathname) -> %any } -> %any'
|
15
|
+
type :atime, '() -> Time'
|
16
|
+
type :basename, '(?String p1) -> Pathname' # guessing about arg type
|
17
|
+
type :binread, '(?Fixnum length, ?Fixnum offset) -> String'
|
18
|
+
type :binwrite, '(String, ?Fixnum offset) -> Fixnum' # TODO open_args
|
19
|
+
type :birthtime, '() -> Time'
|
20
|
+
type :blockdev?, '() -> %bool'
|
21
|
+
type :chardev?, '() -> %bool'
|
22
|
+
type :children, '(%bool with_directory) -> Array<Pathname>'
|
23
|
+
type :chmod, '(Fixnum mode) -> Fixnum'
|
24
|
+
type :chown, '(Fixnum owner, Fixnum group) -> Fixnum'
|
25
|
+
type :cleanpath, '(?%bool consider_symlink) -> %any'
|
26
|
+
type :ctime, '() -> Time'
|
27
|
+
type :delete, '() -> %any'
|
28
|
+
type :descend, '() { (Pathname) -> %any } -> %any'
|
29
|
+
type :directory?, '() -> %bool'
|
30
|
+
type :dirname, '() -> Pathname'
|
31
|
+
type :each_child, '(%bool with_directory) { (Pathname) -> %any } -> %any'
|
32
|
+
type :each_entry, '() { (Pathname) -> %any } -> %any'
|
33
|
+
type :each_filename, '() { (String) -> %any } -> %any'
|
34
|
+
type :each_filename, '() -> Enumerator<String>'
|
35
|
+
type :each_line, '(?String sep, ?Fixnum limit) { (String) -> %any } -> %any' # TODO open_args
|
36
|
+
type :each_line, '(?String sep, ?Fixnum limit) -> Enumerator<String>'
|
37
|
+
type :entries, '() -> Array<Pathname>'
|
38
|
+
type :eql?, '(%any) -> %bool'
|
39
|
+
type :executable?, '() -> %bool'
|
40
|
+
type :executable_real?, '() -> %bool'
|
41
|
+
type :exist?, '() -> %bool'
|
42
|
+
type :expand_path, '(?(String or Pathname) p1) -> Pathname'
|
43
|
+
type :extname, '() -> String'
|
44
|
+
type :file?, '() -> %bool'
|
45
|
+
type :find, '(%bool ignore_error) { (Pathname) -> %any } -> %any'
|
46
|
+
type :find, '(%bool ignore_error) -> Enumerator<Pathname>'
|
47
|
+
type :fnmatch, '(String pattern, ?Fixnum flags) -> %bool'
|
48
|
+
type :freeze, '() -> self' # TODO return type?
|
49
|
+
type :ftype, '() -> String'
|
50
|
+
type :grpowned?, '() -> %bool'
|
51
|
+
type :join, '(*(String or Pathname) args) -> Pathname'
|
52
|
+
type :lchmod, '(Fixnum mode) -> Fixnum'
|
53
|
+
type :lchown, '(Fixnum owner, Fixnum group) -> Fixnum'
|
54
|
+
type :lstat, '() -> File::Stat'
|
55
|
+
type :make_link, '(String old) -> 0'
|
56
|
+
type :symlink, '(String old) -> 0'
|
57
|
+
type :mkdir, '(String p1) -> 0'
|
58
|
+
type :mkpath, '() -> %any' # TODO return?
|
59
|
+
type :mountpoint?, '() -> %bool'
|
60
|
+
type :mtime, '() -> Time'
|
61
|
+
type :open, '(?String mode, ?String perm, ?Fixnum opt) -> File'
|
62
|
+
type :open, '(?String mode, ?String perm, ?Fixnum opt) { (File) -> t } -> t'
|
63
|
+
type :opendir, '(?Encoding) -> Dir'
|
64
|
+
type :opendir, '(?Encoding) { (Dir) -> u } -> u'
|
65
|
+
type :owned?, '() -> %bool'
|
66
|
+
type :parent, '() -> Pathname'
|
67
|
+
type :pipe?, '() -> %bool'
|
68
|
+
type :read, '(?Fixnum length, ?Fixnum offset, ?Fixnum open_args) -> String'
|
69
|
+
type :readable?, '() -> %bool'
|
70
|
+
type :readable_real, '() -> %bool'
|
71
|
+
type :readlines, '(?String sep, ?Fixnum limit, ?Fixnum open_args) -> Array<String>'
|
72
|
+
type :readlink, '() -> String file'
|
73
|
+
type :realdirpath, '(?String p1) -> String'
|
74
|
+
type :realpath, '(?String p1) -> String'
|
75
|
+
type :relative?, '() -> %bool'
|
76
|
+
type :relative_path_from, '(String or Pathname base_directory) -> Pathname'
|
77
|
+
type :rename, '(String p1) -> 0'
|
78
|
+
type :rmdir, '() -> 0'
|
79
|
+
type :rmtree, '() -> 0'
|
80
|
+
type :root?, '() -> %bool'
|
81
|
+
type :setgid?, '() -> %bool'
|
82
|
+
type :setuid?, '() -> %bool'
|
83
|
+
type :size, '() -> Fixnum'
|
84
|
+
type :size?, '() -> %bool'
|
85
|
+
type :socket?, '() -> %bool'
|
86
|
+
type :split, '() -> [Pathname, Pathname]'
|
87
|
+
type :stat, '() -> File::Stat'
|
88
|
+
type :sticky?, '() -> %bool'
|
89
|
+
type :sub, '(*String args) -> Pathname'
|
90
|
+
type :sub_ext, '(String p1) -> Pathname'
|
91
|
+
type :symlink?, '() -> %bool'
|
92
|
+
type :sysopen, '(?Fixnum mode, ?Fixnum perm) -> Fixnum'
|
93
|
+
type :taint, '() -> self'
|
94
|
+
type :to_path, '() -> String'
|
95
|
+
rdl_alias :to_s, :to_path
|
96
|
+
type :truncate, '(Fixnum length) -> 0'
|
97
|
+
type :unlink, '() -> Fixnum'
|
98
|
+
type :untaint, '() -> self'
|
99
|
+
type :utime, '(Time atime, Time mtime) -> Fixnum'
|
100
|
+
type :world_readable?, '() -> %bool'
|
101
|
+
type :world_writable?, '() -> %bool'
|
102
|
+
type :writable?, '() -> %bool'
|
103
|
+
type :writable_real?, '() -> %bool'
|
104
|
+
type :write, '(String, ?Fixnum offset, ?Fixnum open_args) -> Fixnum'
|
105
|
+
type :zero?, '() -> %bool'
|
106
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
module Process
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
type 'self.abort', '(?String msg) -> %any'
|
5
|
+
type 'self.argv0', '() -> String frozen_string'
|
6
|
+
type 'self.clock_getres', '(Symbol or Fixnum clock_id, ?Symbol unit) -> Float or Integer'
|
7
|
+
type 'self.clock_gettime', '(Symbol or Fixnum clock_id, ?Symbol unit) -> Float or Integer'
|
8
|
+
type 'self.daemon', '(?%any nochdir, ?%any noclose) -> 0'
|
9
|
+
type 'self.detach', '(Fixnum pid) -> Thread'
|
10
|
+
type 'self.egid', '() -> Fixnum'
|
11
|
+
type 'self.egid=', '(Fixnum) -> Fixnum'
|
12
|
+
type 'self.euid', '() -> Fixnum'
|
13
|
+
type 'self.euid=', '(Fixnum) -> Fixnum user'
|
14
|
+
# type 'self.exec', '(env: ?Hash<String, String>, command:String, args:*String) -> %any' # TODO: env
|
15
|
+
type 'self.exit', '(?Fixnum status) -> %any'
|
16
|
+
type 'self.exit!', '(?Fixnum status) -> %any'
|
17
|
+
type 'self.fork', '() -> Fixnum or nil'
|
18
|
+
type 'self.fork', '() { () -> %any } -> Fixnum or nil'
|
19
|
+
type 'self.getpgid', '(Fixnum pid) -> Fixnum'
|
20
|
+
type 'self.getpgrp', '() -> Fixnum'
|
21
|
+
type 'self.getpriority', '(Fixnum kind, Fixnum) -> Fixnum'
|
22
|
+
type 'self.getrlimit', '(Symbol or String or Fixnum resource) -> [Fixnum, Fixnum] cur_max_limit'
|
23
|
+
type 'self.getsid', '(?Fixnum pid) -> Integer'
|
24
|
+
type 'self.gid', '() -> Fixnum'
|
25
|
+
type 'self.gid=', '(Fixnum) -> Fixnum'
|
26
|
+
type 'self.groups', '() -> Array<Fixnum>'
|
27
|
+
type 'self.groups=', '(Array<Fixnum>) -> Array<Fixnum>'
|
28
|
+
type 'self.initgroups', '(String username, Fixnum gid) -> Array<Fixnum>'
|
29
|
+
type 'self.kill', '(Fixnum or Symbol or String signal, *Fixnum pids) -> Fixnum'
|
30
|
+
type 'self.maxgroups', '() -> Fixnum'
|
31
|
+
type 'self.maxgroups=', '(Fixnum) -> Fixnum'
|
32
|
+
type 'self.pid', '() -> Fixnum'
|
33
|
+
type 'self.ppid', '() -> Fixnum'
|
34
|
+
type 'self.pgid', '(Fixnum pid, Fixnum) -> Fixnum'
|
35
|
+
type 'self.setpriority', '(Fixnum kind, Fixnum, Fixnum priority) -> 0'
|
36
|
+
type 'self.setproctitle', '(String) -> String'
|
37
|
+
type 'self.setrlimit', '(Symbol or String or Fixnum resource, Fixnum cur_limit, ?Fixnum max_limit) -> nil'
|
38
|
+
type 'self.setsid', '() -> Fixnum'
|
39
|
+
# type 'self.spawn', '(?Hash<String, String> env, String command, *String args) -> %any' # TODO: env
|
40
|
+
type 'self.times', '() -> Process::Tms'
|
41
|
+
type 'self.uid', '() -> Fixnum'
|
42
|
+
type 'self.uid=', '(Fixnum user) -> Fixnum'
|
43
|
+
type 'self.wait', '(?Fixnum pid, ?Fixnum flags) -> Fixnum'
|
44
|
+
type 'self.wait2', '(?Fixnum pid, ?Fixnum flags) -> [Fixnum, Fixnum] pid_and_status'
|
45
|
+
type 'self.waitall', '() -> Array<[Fixnum, Fixnum]>'
|
46
|
+
type 'self.waitpid', '(?Fixnum pid, ?Fixnum flags) -> Fixnum'
|
47
|
+
type 'self.waitpid2', '(?Fixnum pid, ?Fixnum flags) -> [Fixnum, Fixnum] pid_and_status'
|
48
|
+
|
49
|
+
module GID
|
50
|
+
nowrap
|
51
|
+
|
52
|
+
type 'self.change_privilege', '(Fixnum group) -> Fixnum'
|
53
|
+
type 'self.eid', '() -> Fixnum'
|
54
|
+
type 'self.from_name', '(String name) -> Fixnum gid'
|
55
|
+
type 'self.grant_privilege', '(Fixnum group) -> Fixnum'
|
56
|
+
rdl_alias 'self.eid=', 'self.grant_privilege'
|
57
|
+
type 'self.re_exchange', '() -> Fixnum'
|
58
|
+
type 'self.re_exchangeable?', '() -> %bool'
|
59
|
+
type 'self.rid', '() -> Fixnum'
|
60
|
+
type 'self.sid_available?', '() -> %bool'
|
61
|
+
type 'self.switch', '() -> Fixnum'
|
62
|
+
type 'self.switch', '() { () -> t } -> t'
|
63
|
+
end
|
64
|
+
|
65
|
+
module UID
|
66
|
+
nowrap
|
67
|
+
|
68
|
+
type 'self.change_privilege', '(Fixnum user) -> Fixnum'
|
69
|
+
type 'self.eid', '() -> Fixnum'
|
70
|
+
type 'self.from_name', '(String name) -> Fixnum uid'
|
71
|
+
type 'self.grant_privilege', '(Fixnum user) -> Fixnum'
|
72
|
+
rdl_alias 'self.eid=', 'self.grant_privilege'
|
73
|
+
type 'self.re_exchange', '() -> Fixnum'
|
74
|
+
type 'self.re_exchangeable?', '() -> %bool'
|
75
|
+
type 'self.rid', '() -> Fixnum'
|
76
|
+
type 'self.sid_available?', '() -> %bool'
|
77
|
+
type 'self.switch', '() -> Fixnum'
|
78
|
+
type 'self.switch', '() { () -> t } -> t'
|
79
|
+
end
|
80
|
+
|
81
|
+
class Status
|
82
|
+
nowrap
|
83
|
+
|
84
|
+
type :&, '(Fixnum num) -> Fixnum'
|
85
|
+
type :==, '(%any other) -> %bool'
|
86
|
+
type :>>, '(Fixnum num) -> Fixnum'
|
87
|
+
type :coredump?, '() -> %bool'
|
88
|
+
type :exited?, '() -> %bool'
|
89
|
+
type :exitstatus, '() -> Fixnum or nil'
|
90
|
+
type :inspect, '() -> String'
|
91
|
+
type :pid, '() -> Fixnum'
|
92
|
+
type :signaled?, '() -> %bool'
|
93
|
+
type :stopped?, '() -> %bool'
|
94
|
+
type :stopsig, '() -> Fixnum or nil'
|
95
|
+
type :success?, '() -> %bool'
|
96
|
+
type :termsig, '() -> Fixnum or nil'
|
97
|
+
type :to_i, '() -> Fixnum'
|
98
|
+
rdl_alias :to_int, :to_i
|
99
|
+
type :to_s, '() -> String'
|
100
|
+
end
|
101
|
+
|
102
|
+
module Sys
|
103
|
+
nowrap
|
104
|
+
|
105
|
+
type 'self.geteid', '() -> Fixnum'
|
106
|
+
type 'self.geteuid', '() -> Fixnum'
|
107
|
+
type 'self.getgid', '() -> Fixnum'
|
108
|
+
type 'self.getuid', '() -> Fixnum'
|
109
|
+
type 'self.issetugid', '() -> %bool'
|
110
|
+
type 'self.setegid', '(Fixnum group) -> nil'
|
111
|
+
type 'self.seteuid', '(Fixnum user) -> nil'
|
112
|
+
type 'self.setgid', '(Fixnum group) -> nil'
|
113
|
+
type 'self.setregid', '(Fixnum rid, Fixnum eid) -> nil'
|
114
|
+
type 'self.setresgid', '(Fixnum rid, Fixnum eid, Fixnum sid) -> nil'
|
115
|
+
type 'self.setresuid', '(Fixnum rid, Fixnum eid, Fixnum sid) -> nil'
|
116
|
+
type 'self.setreuid', '(Fixnum rid, Fixnum eid) -> nil'
|
117
|
+
type 'self.setrgid', '(Fixnum group) -> nil'
|
118
|
+
type 'self.setruid', '(Fixnum user) -> nil'
|
119
|
+
type 'self.setuid', '(Fixnum user) -> nil'
|
120
|
+
end
|
121
|
+
|
122
|
+
class Waiter
|
123
|
+
nowrap
|
124
|
+
|
125
|
+
type 'pid', '() -> Fixnum'
|
126
|
+
end
|
127
|
+
end
|