rdl 1.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/lib/rails_types.rb +1 -0
  3. data/lib/rdl.rb +56 -0
  4. data/lib/rdl/config.rb +121 -0
  5. data/lib/rdl/contracts/and.rb +29 -0
  6. data/lib/rdl/contracts/contract.rb +7 -0
  7. data/lib/rdl/contracts/flat.rb +31 -0
  8. data/lib/rdl/contracts/or.rb +25 -0
  9. data/lib/rdl/contracts/proc.rb +24 -0
  10. data/lib/rdl/switch.rb +20 -0
  11. data/lib/rdl/types/annotated_arg.rb +41 -0
  12. data/lib/rdl/types/finitehash.rb +81 -0
  13. data/lib/rdl/types/generic.rb +100 -0
  14. data/lib/rdl/types/intersection.rb +66 -0
  15. data/lib/rdl/types/lexer.rex +39 -0
  16. data/lib/rdl/types/lexer.rex.rb +148 -0
  17. data/lib/rdl/types/method.rb +219 -0
  18. data/lib/rdl/types/nil.rb +50 -0
  19. data/lib/rdl/types/nominal.rb +80 -0
  20. data/lib/rdl/types/optional.rb +54 -0
  21. data/lib/rdl/types/parser.racc +150 -0
  22. data/lib/rdl/types/parser.tab.rb +654 -0
  23. data/lib/rdl/types/singleton.rb +62 -0
  24. data/lib/rdl/types/structural.rb +72 -0
  25. data/lib/rdl/types/top.rb +50 -0
  26. data/lib/rdl/types/tuple.rb +61 -0
  27. data/lib/rdl/types/type.rb +24 -0
  28. data/lib/rdl/types/type_inferencer.rb +73 -0
  29. data/lib/rdl/types/union.rb +74 -0
  30. data/lib/rdl/types/var.rb +51 -0
  31. data/lib/rdl/types/vararg.rb +54 -0
  32. data/lib/rdl/types/wild.rb +26 -0
  33. data/lib/rdl/util.rb +56 -0
  34. data/lib/rdl/wrap.rb +505 -0
  35. data/lib/rdl_types.rb +2 -0
  36. data/types/other/chronic.rb +5 -0
  37. data/types/other/paperclip_attachment.rb +7 -0
  38. data/types/other/securerandom.rb +4 -0
  39. data/types/rails-4.2.1/fixnum.rb +3 -0
  40. data/types/rails-4.2.1/string.rb +3 -0
  41. data/types/rails-tmp/action_dispatch.rb +406 -0
  42. data/types/rails-tmp/active_record.rb +406 -0
  43. data/types/rails-tmp/devise_contracts.rb +216 -0
  44. data/types/ruby-2.2.0/_aliases.rb +4 -0
  45. data/types/ruby-2.2.0/abbrev.rb +5 -0
  46. data/types/ruby-2.2.0/array.rb +137 -0
  47. data/types/ruby-2.2.0/base64.rb +10 -0
  48. data/types/ruby-2.2.0/basic_object.rb +13 -0
  49. data/types/ruby-2.2.0/benchmark.rb +11 -0
  50. data/types/ruby-2.2.0/bigdecimal.rb +15 -0
  51. data/types/ruby-2.2.0/bigmath.rb +12 -0
  52. data/types/ruby-2.2.0/class.rb +17 -0
  53. data/types/ruby-2.2.0/complex.rb +42 -0
  54. data/types/ruby-2.2.0/coverage.rb +6 -0
  55. data/types/ruby-2.2.0/csv.rb +5 -0
  56. data/types/ruby-2.2.0/date.rb +6 -0
  57. data/types/ruby-2.2.0/dir.rb +38 -0
  58. data/types/ruby-2.2.0/encoding.rb +23 -0
  59. data/types/ruby-2.2.0/enumerable.rb +98 -0
  60. data/types/ruby-2.2.0/enumerator.rb +26 -0
  61. data/types/ruby-2.2.0/exception.rb +15 -0
  62. data/types/ruby-2.2.0/file.rb +124 -0
  63. data/types/ruby-2.2.0/fileutils.rb +6 -0
  64. data/types/ruby-2.2.0/fixnum.rb +45 -0
  65. data/types/ruby-2.2.0/float.rb +54 -0
  66. data/types/ruby-2.2.0/gem.rb +245 -0
  67. data/types/ruby-2.2.0/hash.rb +72 -0
  68. data/types/ruby-2.2.0/integer.rb +31 -0
  69. data/types/ruby-2.2.0/io.rb +103 -0
  70. data/types/ruby-2.2.0/kernel.rb +89 -0
  71. data/types/ruby-2.2.0/marshal.rb +5 -0
  72. data/types/ruby-2.2.0/matchdata.rb +26 -0
  73. data/types/ruby-2.2.0/math.rb +53 -0
  74. data/types/ruby-2.2.0/numeric.rb +46 -0
  75. data/types/ruby-2.2.0/object.rb +73 -0
  76. data/types/ruby-2.2.0/pathname.rb +106 -0
  77. data/types/ruby-2.2.0/process.rb +127 -0
  78. data/types/ruby-2.2.0/random.rb +15 -0
  79. data/types/ruby-2.2.0/range.rb +38 -0
  80. data/types/ruby-2.2.0/rational.rb +31 -0
  81. data/types/ruby-2.2.0/regexp.rb +30 -0
  82. data/types/ruby-2.2.0/set.rb +58 -0
  83. data/types/ruby-2.2.0/string.rb +145 -0
  84. data/types/ruby-2.2.0/strscan.rb +7 -0
  85. data/types/ruby-2.2.0/symbol.rb +29 -0
  86. data/types/ruby-2.2.0/time.rb +68 -0
  87. data/types/ruby-2.2.0/uri.rb +18 -0
  88. data/types/ruby-2.2.0/yaml.rb +5 -0
  89. metadata +131 -0
@@ -0,0 +1,42 @@
1
+ class Complex
2
+ nowrap
3
+
4
+ type 'self.polar', '(%real abs, ?%real arg) -> Complex'
5
+ type 'self.rect', '(%real real, ?%real imag) -> Complex'
6
+ pre('self.rect') { |r, i| (not i) || (i.real?) }
7
+ rdl_alias 'self.rectangular', 'self.rect'
8
+ type :*, '(Numeric) -> Complex'
9
+ type :**, '(Numeric) -> Complex'
10
+ type :+, '(Numeric) -> Complex'
11
+ type :-, '(Numeric) -> Complex'
12
+ type :-, '() -> Complex'
13
+ type :/, '(Numeric) -> Complex'
14
+ type :==, '(%any object) -> %bool'
15
+ type :abs, '() -> %real'
16
+ post(:abs) { |r| r >= 0 }
17
+ type :abs2, '() -> %real'
18
+ post(:abs2) { |r| r >= 0 }
19
+ type :angle, '() -> Float'
20
+ type :arg, '() -> Float'
21
+ type :conj, '() -> Complex'
22
+ rdl_alias :conjugate, :conj
23
+ type :denominator, '() -> Integer'
24
+ type :fdiv, '(Numeric) -> Complex'
25
+ type :imag, '() -> %real'
26
+ rdl_alias :imaginary, :imag
27
+ type :inspect, '() -> String'
28
+ type :magnitude, '() -> %real'
29
+ type :numerator, '() -> Numeric'
30
+ type :phase, '() -> Float'
31
+ type :polar, '() -> [%real, %real]'
32
+ rdl_alias :quo, :/
33
+ type :rationalize, '(?Numeric eps) -> Rational'
34
+ type :real, '() -> %real'
35
+ type :real?, '() -> FalseClass'
36
+ type :rect, '() -> [%real, %real]'
37
+ type :to_c, '() -> self'
38
+ type :to_f, '() -> Float'
39
+ type :to_i, '() -> Integer'
40
+ type :to_r, '() -> Rational'
41
+ type :to_s, '() -> String'
42
+ end
@@ -0,0 +1,6 @@
1
+ module Coverage
2
+ nowrap
3
+
4
+ type 'self.start', '() -> nil'
5
+ type 'self.result', '() -> Hash<String,Array<Fixnum or nil>>'
6
+ end
@@ -0,0 +1,5 @@
1
+ class CSV
2
+ nowrap
3
+
4
+ type 'self.foreach', '(String or File, ?Hash<Symbol, %any>) {(Array<String>) -> %any} -> NilClass'
5
+ end
@@ -0,0 +1,6 @@
1
+ class Date
2
+ nowrap
3
+
4
+ type('self.now', "() -> DateTime")
5
+ type(:strftime, "(String) -> String")
6
+ end
@@ -0,0 +1,38 @@
1
+ class Dir
2
+ nowrap
3
+
4
+ rdl_alias :[], :glob
5
+ type 'self.chdir', '(?(String or Pathname)) -> 0'
6
+ type 'self.chdir', '(?(String or Pathname)) { (String) -> u } -> u'
7
+ type 'self.chroot', '(String) -> 0'
8
+ type 'self.delete', '(String) -> 0'
9
+ type 'self.entries', '(String, ?Encoding) -> Array<String>'
10
+ type 'self.exist?', '(String file) -> %bool'
11
+ # exists? deprecated
12
+ type 'self.foreach', '(String dir, ?Encoding) { (String) -> %any } -> nil'
13
+ type 'self.foreach', '(String dir, ?Encoding) -> Enumerator<String>'
14
+ type 'self.getwd', '() -> String'
15
+ type 'self.glob', '(String or Array<String> pattern, ?Fixum flags) -> Array<String>'
16
+ type 'self.glob', '(String or Array<String> pattern, ?Fixum flags) { (String) -> %any} -> nil'
17
+ type 'self.home', '(?String) -> String'
18
+ type 'self.mkdir', '(String, ?Fixnum) -> 0'
19
+ type 'self.new', '(String, ?Encoding) -> Dir'
20
+ type 'self.open', '(String, ?Encoding) -> Dir'
21
+ type 'self.open', '(String, ?Encoding) { (Dir) -> u } -> u'
22
+ type 'self.pwd', '() -> String'
23
+ type 'self.rmdir', '(String) -> 0'
24
+ type 'self.unlink', '(String) -> 0'
25
+ type :close, '() -> nil'
26
+ type :each, '() { (String) -> %any } -> self'
27
+ type :each, '() -> Enumerator<String>'
28
+ type :fileno, '() -> Fixnum'
29
+ type :inspect, '() -> String'
30
+ type :path, '() -> String or nil'
31
+ type :pos, '() -> Fixnum'
32
+ type :pos=, '(Fixnum) -> Fixnum'
33
+ type :read, '() -> String or nil'
34
+ type :rewind, '() -> self'
35
+ type :seek, '(Fixnum) -> self'
36
+ type :tell, '() -> Fixnum'
37
+ type :to_path, '() -> String or nil'
38
+ end
@@ -0,0 +1,23 @@
1
+ class Encoding
2
+ nowrap
3
+
4
+ type 'self.aliases', '() -> Hash<String, String>'
5
+ type 'self.compatible?', '(%any obj1, %any obj2) -> Encoding or nil'
6
+ type 'self.default_external', '() -> Encoding'
7
+ type 'self.default_external=', '(String) -> String'
8
+ type 'self.default_external=', '(Encoding) -> Encoding'
9
+ type 'self.default_internal', '() -> Encoding'
10
+ type 'self.default_internal=', '(String) -> String or nil'
11
+ type 'self.default_internal=', '(Encoding) -> Encoding or nil'
12
+ type 'self.find', '(String or Encoding) -> Encoding'
13
+ type 'self.list', '() -> Array<Encoding>'
14
+ type 'self.name_list', '() -> Array<String>'
15
+
16
+ type :ascii_compatible?, '() -> %bool'
17
+ type :dummy?, '() -> %bool'
18
+ type :inspect, '() -> String'
19
+ type :name, '() -> String'
20
+ type :names, '() -> Array<String>'
21
+ type :replicate, '(String name) -> Encoding'
22
+ rdl_alias :to_s, :name
23
+ end
@@ -0,0 +1,98 @@
1
+ module Enumerable
2
+ nowrap
3
+
4
+ type_params [:t], :all?
5
+
6
+ type :all?, '() -> %bool'
7
+ type :all?, '() { (t) -> %bool } -> %bool'
8
+ type :any?, '() -> %bool'
9
+ type :any?, '() { (t) -> %bool } -> %bool'
10
+ # type :chunk, '(XXXX : *XXXX)' # TODO
11
+ type :collect, '() { (t) -> u } -> Array<u>'
12
+ type :collect, '() -> Enumerator<t>'
13
+ # type :collect_concat # TODO
14
+ type :count, '() -> Fixnum'
15
+ type :count, '(%any) -> Fixnum'
16
+ type :count, '() { (t) -> %bool } -> Fixnum'
17
+ type :cycle, '(?Fixnum n) { (t) -> %any } -> nil'
18
+ type :cycle, '(?Fixnum n) -> Enumerator<t>'
19
+ type :detect, '(?Proc ifnone) { (t) -> %bool } -> t or nil' # TODO ifnone
20
+ type :detect, '(?Proc ifnone) -> Enumerator<t>'
21
+ type :drop, '(Fixnum n) -> Array<t>'
22
+ type :drop_while, '() { (t) -> %bool } -> Array<t>'
23
+ type :drop_while, '() -> Enumerator<t>'
24
+ type :each_cons, '(Fixnum n) { (Array<t>) -> %any } -> nil'
25
+ type :each_cons, '(Fixnum n) -> Enumerator<t>'
26
+ # type :each_entry, '(XXXX : *XXXX)' # TODO
27
+ rdl_alias :each_slice, :each_cons
28
+ type :each_with_index, '() { (t, Fixnum) -> %any } -> Enumerable<t>' # args! note may not return self
29
+ type :each_with_index, '() -> Enumerable<t>' # args! note may not return self
30
+ # type :each_with_object, '(XXXX : XXXX)' #TODO
31
+ type :entries, '() -> Array<t>' # TODO args?
32
+ rdl_alias :find, :detect
33
+ type :find_all, '() { (t) -> %bool } -> Array<t>'
34
+ type :find_all, '() -> Enumerator<t>'
35
+ type :find_index, '(%any value) -> Fixnum or nil'
36
+ type :find_index, '() { (t) -> %bool } -> Fixnum or nil'
37
+ type :find_index, '() -> Enumerator<t>'
38
+ type :first, '() -> t or nil'
39
+ type :first, '(Fixnum n) -> Array<t> or nil'
40
+ # rdl_alias :flat_map, :collect_concat
41
+ type :grep, '(%any) -> Array<t>'
42
+ type :grep, '(%any) { (t) -> u } -> Array<u>'
43
+ type :group_by, '() { (t) -> u } -> Hash<u, Array<t>>'
44
+ type :group_by, '() -> Enumerator<t>'
45
+ type :include?, '(%any) -> %bool'
46
+ type :inject, '(any initial, Symbol) -> %any' # can't tell initial, return type; not enough info in Symbol
47
+ type :inject, '(Symbol) -> %any'
48
+ type :inject, '(u initial) { (u, t) -> u } -> u'
49
+ type :inject, '() { (t, t) -> t } -> t' # if initial not given, first element is initial
50
+ # type :lazy # TODO
51
+ rdl_alias :map, :collect
52
+ type :max, '() -> t'
53
+ type :max, '() { (t, t) -> Fixnum } -> t'
54
+ type :max, '(Fixnum) -> Array<t>'
55
+ type :max, '(Fixnum) { (t, t) -> Fixnum } -> Array<t>'
56
+ type :max_by, '() -> Enumerator<t>'
57
+ type :max_by, '() { (t, t) -> Fixnum } -> t'
58
+ type :max_by, '(Fixnum) -> Enumerator<t>'
59
+ type :max_by, '(Fixnum) { (t, t) -> Fixnum } -> Array<t>'
60
+ rdl_alias :member?, :include?
61
+ type :min, '() -> t'
62
+ type :min, '() { (t, t) -> Fixnum } -> t'
63
+ type :min, '(Fixnum) -> Array<t>'
64
+ type :min, '(Fixnum) { (t, t) -> Fixnum } -> Array<t>'
65
+ type :min_by, '() -> Enumerator<t>'
66
+ type :min_by, '() { (t, t) -> Fixnum } -> t'
67
+ type :min_by, '(Fixnum) -> Enumerator<t>'
68
+ type :min_by, '(Fixnum) { (t, t) -> Fixnum } -> Array<t>'
69
+ type :minmax, '() -> [t, t]'
70
+ type :minmax, '() { (t, t) -> Fixnum } -> [t, t]'
71
+ type :minmax_by, '() -> [t, t]'
72
+ type :minmax_by, '() { (t, t) -> Fixnum } -> Enumerator<t>'
73
+ type :none?, '() -> %bool'
74
+ type :none?, '() { (t) -> %bool } -> %bool'
75
+ type :one?, '() -> %bool'
76
+ type :one?, '() { (t) -> %bool } -> %bool'
77
+ type :partition, '() { (t) -> %bool } -> [Array<t>, Array<t>]'
78
+ type :partition, '() -> Enumerator<t>'
79
+ rdl_alias :reduce, :inject
80
+ type :reject, '() { (t) -> %bool } -> Array<t>'
81
+ type :reject, '() -> Enumerator<t>'
82
+ type :reverse_each, '() { (t) -> %any } -> Enumerator<t>' # is that really the return type? TODO args
83
+ type :reverse_each, '() -> Enumerator<t>' # TODO args
84
+ rdl_alias :select, :find_all
85
+ # type :slice_after, '(XXXX : *XXXX)' # TODO
86
+ # type :slice_before, '(XXXX : *XXXX)' # TODO
87
+ # type :slice_when, '()' # TODO
88
+ type :sort, '() -> Array<t>'
89
+ type :sort, '() { (t, t) -> Fixnum } -> Array<t>'
90
+ type :sort_by, '() { (t) -> %any } -> Array<t>'
91
+ type :sort_by, '() -> Enumerator<t>'
92
+ type :take, '(Fixnum n) -> Array<t> or nil'
93
+ type :take_while, '() { (t) -> %bool } -> Array<t>'
94
+ type :take_while, '() -> Enumerator<t>'
95
+ rdl_alias :to_a, :entries
96
+ type :to_h, '() -> Hash<t, t>' # TODO args?
97
+ # type :zip, '(XXXX : *XXXX)' # TODO
98
+ end
@@ -0,0 +1,26 @@
1
+ class Enumerator
2
+ nowrap
3
+
4
+ type_params [:t], :all?
5
+
6
+ type 'self.new', '(?Fixnum) { (Array<u>) -> %any } -> Enumerator<u>'
7
+ type 'self.new', '(?Proc) { (Array<u>) -> %any } -> Enumerator<u>' # TODO Proc
8
+ # TODO: deprecated form of new
9
+ type :each, '() { (t) -> %any } -> %any' # is there a better type?
10
+ type :each, '() -> self'
11
+ # TODO: args
12
+ type :each_with_index, '() { (t, Fixnum) -> %any } -> %any' # TODO args
13
+ type :each_with_index, '() -> Enumerator<[t, Fixnum]>' # TODO args
14
+ type :each_with_object, '(u) { (t, u) -> %any } -> %any' # TODO args
15
+ type :each_with_object, '(u) -> Enumerator<[t, u]>' # TODO args
16
+ type :feed, '(t) -> nil'
17
+ type :inspect, '() -> String'
18
+ type :next, '() -> t'
19
+ type :next_values, '() -> Array<t>'
20
+ type :peek, '() -> t'
21
+ type :peek_values, '() -> Array<t>'
22
+ type :rewrind, '() -> self'
23
+ type :size, '() -> Fixnum or Float or nil'
24
+ rdl_alias :with_index, :each_with_index
25
+ rdl_alias :with_object, :each_with_object
26
+ end
@@ -0,0 +1,15 @@
1
+ class Exception
2
+ type '==', '(%any) -> %bool'
3
+ type 'backtrace', '() -> Array<String>'
4
+ type 'backtrace_locations', '() -> Array<Thread::Backtrace::Location>'
5
+ type 'cause', '() -> nil' # TODO exception is proper postcondition
6
+ type 'exception', '(?String) -> Exception' # or error
7
+ # type 'initialize', '() -> '
8
+ type 'inspect', '() -> String'
9
+ type 'message', '() -> String'
10
+ # type 'method_missing', '() -> '
11
+ # type 'respond_to?', '() -> '
12
+ # type 'respond_to_missing?', '() -> '
13
+ type 'set_backtrace', '(String or Array<String>) -> Array<String>'
14
+ type 'to_s', '() -> String'
15
+ end
@@ -0,0 +1,124 @@
1
+ class File
2
+ nowrap
3
+
4
+ type 'self.absolute_path', '(String file, ?String dir) -> String abs_file'
5
+ type 'self.atime', '(%path or IO file) -> Time'
6
+ type 'self.basename', '(String file, ?String suffix) -> String base_name'
7
+ type 'self.birthtime', '(%path or IO file) -> Time'
8
+ type 'self.blockdev?', '(String or IO file) -> %bool'
9
+ type 'self.chardev?', '(String or IO file) -> %bool'
10
+ type 'self.chmod', '(Fixnum mode, *String files) -> Fixnum'
11
+ type 'self.chown', '(Fixnum owner, Fixnum group, *String files) -> Fixnum'
12
+ type 'self.ctime', '(%path or IO file) -> Time'
13
+ type 'self.delete', '(*String files) -> Fixnum'
14
+ type 'self.directory?', '(String or IO file) -> %bool'
15
+ type 'self.dirname', '(String file) -> String dir'
16
+ type 'self.executable?', '(String file) -> %bool'
17
+ type 'self.executable_real?', '(String file) -> %bool'
18
+ type 'self.exist?', '(%path or IO file) -> %bool'
19
+ # exists? deprecated
20
+ type 'self.expand_path', '(%path file, ?%path dir) -> String abs_file'
21
+ type 'self.extname', '(String path) -> String'
22
+ type 'self.file?', '(String or IO file) -> %bool'
23
+ type 'self.fnmatch', '(String pattern, String path, ?Fixnum flags) -> %bool'
24
+ rdl_alias :fnmatch?, :fnmatch
25
+ type 'self.ftype', '(String file) -> String' # TODO: return in set of strings
26
+ type 'self.grpowned?', '(String or IO file) -> %bool'
27
+ type 'self.identical?', '(String or IO file_1, String or IO file_2) -> %bool'
28
+ type 'self.join', '(*(%path or File)) -> String'
29
+ type 'self.lchmod', '(Fixnum mode, *String files) -> Fixnum'
30
+ type 'self.lchown', '(Fixnum owner, Fixnum group, *String files) -> Fixnum'
31
+ type 'self.link', '(String old, String new) -> 0'
32
+ type 'self.lstat', '(String file) -> File::Stat'
33
+ type 'self.mtime', '(%path or IO file) -> Time'
34
+ type 'self.new', '(String file, ?String mode, ?String perm, ?Fixnum opt) -> File'
35
+ type 'self.open', '(%path file, ?String file, ?String perm, ?Fixnum opt, mode:?String, external_encoding: ?String, internal_encoding: ?String, encoding: ?String, textmode: ?%any, binmode: ?%any, autoclose: ?%any) -> File'
36
+ type 'self.open', '(%path file, ?String mode, ?String perm, ?Fixnum opt, mode:?String, external_encoding: ?String, internal_encoding: ?String, encoding: ?String, textmode: ?%any, binmode: ?%any, autoclose: ?%any) { (File) -> t } -> t'
37
+ type 'self.owned?', '(String file) -> %bool'
38
+ type 'self.path', '(String path) -> String'
39
+ type 'self.pipe?', '(String file) -> %bool'
40
+ type 'self.readable?', '(String file) -> %bool'
41
+ type 'self.readable_real?', '(String file) -> %bool'
42
+ type 'self.readlink', '(String link) -> String file'
43
+ type 'self.readldirpath', '(String pathname, ?String dir) -> String real_pathname'
44
+ type 'self.realpath', '(String pathname, ?String dir) -> String real_pathname'
45
+ type 'self.rename', '(String old, String new) -> 0'
46
+ type 'self.setgid?', '(String file) -> %bool'
47
+ type 'self.setuid?', '(String file) -> %bool'
48
+ type 'self.size', '(String or IO file) -> Fixnum'
49
+ type 'self.size?', '(String or IO file) -> Fixnum or nil'
50
+ type 'self.socket?', '(String or IO file) -> %bool'
51
+ type 'self.split', '(String file) -> [String, String]'
52
+ type 'self.stat', '(%path file) -> File::Stat'
53
+ type 'self.sticky?', '(String file) -> %bool'
54
+ type 'self.symlink', '(String old, String new) -> 0'
55
+ type 'self.symlink?', '(String file) -> %bool'
56
+ type 'self.truncate', '(String file, Fixnum) -> 0'
57
+ type 'self.umask', '(?Fixnum) -> Fixnum'
58
+ rdl_alias :unlink, :delete
59
+ type 'self.utime', '(Time atime, Time mtime, *String files) -> Fixnum'
60
+ type 'self.world_readable?', '(String or IO file) -> Fixnum or nil'
61
+ type 'self.world_writable?', '(String or IO file) -> Fixnum or nil'
62
+ type 'self.writable?', '(String file) -> Fixnum or nil'
63
+ type 'self.writable_real?', '(String file) -> Fixnum or nil'
64
+ type 'self.zero?', '(String or IO file) -> Fixnum or nil'
65
+
66
+ type :atime, '() -> Time'
67
+ type :birthtime, '() -> Time'
68
+ type :chmod, '(Fixnum mode) -> 0'
69
+ type :chown, '(Fixnum owner, Fixnum group) -> 0'
70
+ type :ctime, '() -> Time'
71
+ type :flock, '(Fixnum) -> 0 or %bool'
72
+ type :lstat, '() -> File::Stat'
73
+ type :mtime, '() -> Time'
74
+ type :path, '() -> String file'
75
+ type :size, '() -> Fixnum'
76
+ rdl_alias :to_path, :path
77
+ type :truncate, '(Fixnum) -> 0'
78
+
79
+ class Stat
80
+ type 'self.new', '(String file) -> File::Stat'
81
+ type :<=>, '(File::Stat other) -> -1 or 0 or 1 or nil'
82
+ type :atime, '() -> Time'
83
+ type :birthtime, '() -> Time'
84
+ type :blksize, '() -> Fixnum or nil'
85
+ type :blockdev?, '() -> %bool'
86
+ type :blocks, '() -> Fixnum or nil'
87
+ type :chardev?, '() -> %bool'
88
+ type :ctime, '() -> Time'
89
+ type :dev, '() -> Fixnum'
90
+ type :dev_major, '() -> Fixnum'
91
+ type :dev_minor, '() -> Fixnum'
92
+ type :directory?, '(String file) -> %bool'
93
+ type :executable?, '() -> %bool'
94
+ type :executable_real?, '() -> %bool'
95
+ type :file?, '() -> %bool'
96
+ type :ftype, '() -> String'
97
+ type :gid, '() -> Fixnum'
98
+ type :grpowned?, '() -> %bool'
99
+ type :ino, '() -> Fixnum'
100
+ type :inspect, '() -> String'
101
+ type :mode, '() -> Fixnum'
102
+ type :mtime, '() -> Time'
103
+ type :nlink, '() -> Fixnum'
104
+ type :owned?, '() -> %bool'
105
+ type :pip?, '() -> %bool'
106
+ type :rdev, '() -> Fixnum or nil'
107
+ type :rdev_major, '() -> Fixnum'
108
+ type :rdev_minor, '() -> Fixnum'
109
+ type :readable?, '() -> %bool'
110
+ type :readable_real?, '() -> %bool'
111
+ type :setgid?, '() -> %bool'
112
+ type :setuid?, '() -> %bool'
113
+ type :size, '() -> Fixnum'
114
+ type :socket?, '() -> %bool'
115
+ type :sticky?, '() -> %bool'
116
+ type :symlink?, '() -> %bool'
117
+ type :uid, '() -> Fixnum'
118
+ type :world_readable?, '() -> Fixnum or nil'
119
+ type :world_writable?, '() -> Fixnum or nil'
120
+ type :writable?, '() -> %bool'
121
+ type :writable_real?, '() -> %bool'
122
+ type :zero?, '() -> %bool'
123
+ end
124
+ end
@@ -0,0 +1,6 @@
1
+ module FileUtils
2
+ nowrap
3
+
4
+ type('self.cp_r', '(String or Pathname, String or Pathname, ?Hash<:preserve or :noop or :verbose or :dereference_root or :remove_destination, %bool>) -> Array<String>')
5
+ type('self.mkdir_p', '(String or Pathname, ?Hash<:mode or :noop or :verbose, %bool>) -> Array<String>')
6
+ end
@@ -0,0 +1,45 @@
1
+ class Fixnum
2
+ nowrap
3
+
4
+ type :%, '(Numeric other) -> Numeric'
5
+ post(:%) { |r, _| r.real? }
6
+ type :&, '(Integer) -> Integer'
7
+ type :*, '(Numeric) -> Numeric'
8
+ type :**, '(Numeric) -> Numeric'
9
+ type :+, '(Numeric) -> Numeric'
10
+ type :-, '(Numeric) -> Numeric'
11
+ type :-, '() -> Numeric'
12
+ type :/, '(Numeric) -> Numeric'
13
+ type :<, '(Numeric) -> %bool'
14
+ pre(:<) { |x| x.real? }
15
+ type :<<, '(Fixnum count) -> Integer'
16
+ type :<=, '(Numeric) -> %bool'
17
+ pre(:<=) { |x| x.real? }
18
+ type :<=>, '(Numeric) -> -1 or 0 or 1 or nil'
19
+ type :==, '(%any) -> %bool'
20
+ type :>, '(Numeric) -> %bool'
21
+ pre(:>) { |x| x.real? }
22
+ type :>=, '(Numeric) -> %bool'
23
+ pre(:>=) { |x| x.real? }
24
+ type :>>, '(Fixnum count) -> Integer'
25
+ type :[], '(Fixnum) -> 0 or 1'
26
+ type :^, '(Integer) -> Integer'
27
+ type :|, '(Integer) -> Integer'
28
+ type :~, '() -> Integer'
29
+ type :abs, '() -> Integer'
30
+ type :bit_length, '() -> Fixnum'
31
+ type :div, '(Numeric) -> Integer'
32
+ type :divmod, '(Numeric) -> [Numeric, Numeric]'
33
+ type :even?, '() -> %bool'
34
+ type :fdiv, '(Numeric) -> Float'
35
+ rdl_alias :inspect, :to_s
36
+ type :magnitude, '() -> Integer'
37
+ rdl_alias :modulo, :%
38
+ type :next, '() -> Integer'
39
+ type :odd?, '() -> %bool'
40
+ type :size, '() -> Fixnum'
41
+ rdl_alias :succ, :next
42
+ type :to_f, '() -> Float'
43
+ type :to_s, '(?Fixnum base) -> String'
44
+ type :zero?, '() -> %bool'
45
+ end