rdl 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
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,54 @@
1
+ class Float
2
+ nowrap
3
+
4
+ type :%, '(Numeric other) -> Numeric'
5
+ type :*, '(Numeric other) -> Numeric'
6
+ type :**, '(Numeric other) -> Numeric'
7
+ type :+, '(Numeric other) -> Numeric'
8
+ type :-, '(Numeric other) -> Numeric'
9
+ type :-, '() -> Float'
10
+ type :/, '(Numeric other) -> Float'
11
+ type :<, '(Numeric) -> %bool'
12
+ pre(:<) { |x| x.real? }
13
+ type :<=, '(Numeric) -> %bool'
14
+ pre(:<=) { |x| x.real? }
15
+ type :<=>, '(Numeric) -> -1 or 0 or 1 or nil'
16
+ pre(:<=>) { |x| x.real? }
17
+ type :==, '(%any) -> %bool'
18
+ type :>, '(Numeric) -> %bool'
19
+ pre(:>) { |x| x.real? }
20
+ type :>=, '(Numeric) -> %bool'
21
+ pre(:>=) { |x| x.real? }
22
+ type :abs, '() -> Float'
23
+ type :angle, '() -> 0 or ${Math::PI}'
24
+ type :arg, '() -> 0 or ${Math::PI}'
25
+ type :ceil, '() -> Integer'
26
+ type :coerce, '(Numeric) -> [Float, Float]'
27
+ type :denominator, '() -> Integer'
28
+ post(:denominator) { |r, _| r > 0 }
29
+ type :divmod, '(Numeric) -> [Numeric, Numeric]'
30
+ type :equl?, '(%any) -> %bool'
31
+ type :fdiv, '(Numeric) -> Float'
32
+ type :finite?, '() -> %bool'
33
+ type :floor, '() -> Integer'
34
+ type :hash, '() -> Integer'
35
+ type :infinite?, '() -> -1 or 1 or nil'
36
+ rdl_alias :inspect, :to_s
37
+ type :magnitude, '() -> Float'
38
+ rdl_alias :modulo, :%
39
+ type :nan?, '() -> %bool'
40
+ type :next_float, '() -> Float'
41
+ type :numerator, '() -> Integer'
42
+ type :phase, '() -> 0 or ${Math::PI}'
43
+ type :prev_float, '() -> Float'
44
+ rdl_alias :quo, :/
45
+ type :rationalize, '(Float eps) -> Rational'
46
+ type :round, '(?Fixnum ndigits) -> Integer or Float'
47
+ type :to_f, '() -> self'
48
+ type :to_i, '() -> Integer'
49
+ rdl_alias :to_int, :to_i
50
+ type :to_r, '() -> Rational'
51
+ type :to_s, '() -> String'
52
+ type :truncate, '() -> Integer'
53
+ type :zero?, '() -> %bool'
54
+ end
@@ -0,0 +1,245 @@
1
+ module Gem
2
+ type 'self.bin_path', '(String name, ?String exec_name, *Gem::Requirement requirements) -> String'
3
+ type 'self.binary_mode', '() -> String'
4
+ type 'self.bindir', '(?String install_dir) -> String'
5
+ type 'self.clear_default_specs', '() -> Hash'
6
+ type 'self.clear_paths', '() -> nil'
7
+ type 'self.config_file', '() -> String'
8
+ type 'self.configuration', '() -> Gem::ConfigFile'
9
+ type 'self.configuration=', '(%any) -> %any' #returns param
10
+ type 'self.datadir', '(String gem_name) -> String or nil'
11
+ type 'self.default_bindir', '() -> String or nil'
12
+ type 'self.default_cert_path', '() -> String or nil'
13
+ type 'self.default_dir', '() -> String or nil'
14
+ type 'self.default_exec_format', '() -> String or nil'
15
+ type 'self.default_key_path', '() -> String or nil'
16
+ type 'self.default_path', '() -> String or nil'
17
+ type 'self.default_rubygems_dirs', '() -> Array<String> or nil'
18
+ type 'self.default_sources', '() -> Array<String> or nil'
19
+ #type 'self.deflate', '() -> String' # Anything with to_s
20
+ =begin
21
+ type 'self.detect_gemdeps', '() -> '
22
+ type 'self.dir', '() -> '
23
+ type 'self.done_installing', '() -> '
24
+ type 'self.ensure_gem_subdirectories', '() -> '
25
+ type 'self.find_files', '() -> '
26
+ type 'self.find_unresolved_default_spec', '() -> '
27
+ type 'self.finish_resolve', '() -> '
28
+ type 'self.gunzip', '() -> '
29
+ type 'self.gzip', '() -> '
30
+ type 'self.host', '() -> '
31
+ type 'self.host=', '() -> '
32
+ type 'self.inflate', '() -> '
33
+ type 'self.install', '() -> '
34
+ type 'self.latest_rubygems_version', '() -> '
35
+ type 'self.latest_spec_for', '() -> '
36
+ type 'self.latest_version_for', '() -> '
37
+ type 'self.load_env_plugins', '() -> '
38
+ type 'self.load_path_insert_index', '() -> '
39
+ type 'self.load_plugin_files', '() -> '
40
+ type 'self.load_plugins', '() -> '
41
+ type 'self.load_yaml', '() -> '
42
+ type 'self.location_of_caller', '() -> '
43
+ type 'self.marshal_version', '() -> '
44
+ type 'self.needs', '() -> '
45
+ type 'self.path', '() -> '
46
+ type 'self.path_separator', '() -> '
47
+ type 'self.paths', '() -> '
48
+ type 'self.paths=', '() -> '
49
+ type 'self.platforms', '() -> '
50
+ type 'self.platforms=', '() -> '
51
+ type 'self.post_build', '() -> '
52
+ type 'self.post_install', '() -> '
53
+ type 'self.post_reset', '() -> '
54
+ type 'self.post_uninstall', '() -> '
55
+ type 'self.pre_install', '() -> '
56
+ type 'self.pre_reset', '() -> '
57
+ type 'self.pre_uninstall', '() -> '
58
+ type 'self.prefix', '() -> '
59
+ type 'self.read_binary', '() -> '
60
+ type 'self.refresh', '() -> '
61
+ type 'self.register_default_spec', '() -> '
62
+ type 'self.remove_unresolved_default_spec', '() -> '
63
+ type 'self.ruby', '() -> '
64
+ type 'self.ruby=', '() -> '
65
+ type 'self.ruby_engine', '() -> '
66
+ type 'self.ruby_version', '() -> '
67
+ type 'self.rubygems_version', '() -> '
68
+ type 'self.searcher=', '() -> '
69
+ type 'self.sources', '() -> '
70
+ type 'self.sources=', '() -> '
71
+ type 'self.suffix_pattern', '() -> '
72
+ type 'self.suffixes', '() -> '
73
+ type 'self.time', '() -> '
74
+ type 'self.try_activate', '() -> '
75
+ type 'self.ui', '() -> '
76
+ type 'self.use_paths', '() -> '
77
+ type 'self.user_dir', '() -> '
78
+ type 'self.user_home', '() -> '
79
+ type 'self.win_platform=', '() -> '
80
+ type 'self.win_platform?', '() -> '
81
+ =begin
82
+ class Gemspec
83
+ type '<=>', '() -> '
84
+ type '==', '() -> '
85
+ type '_dump', '() -> '
86
+ type 'activate', '() -> '
87
+ type 'activate_dependencies', '() -> '
88
+ type 'activated', '() -> '
89
+ type 'activated=', '() -> '
90
+ type 'activated?', '() -> '
91
+ type 'add_bindir', '() -> '
92
+ type 'add_dependency', '() -> '
93
+ type 'add_dependency_with_type', '() -> '
94
+ type 'add_development_dependency', '() -> '
95
+ type 'add_runtime_dependency', '() -> '
96
+ type 'add_self_to_load_path', '() -> '
97
+ type 'author', '() -> '
98
+ type 'author=', '() -> '
99
+ type 'authors', '() -> '
100
+ type 'authors=', '() -> '
101
+ type 'autorequire', '() -> '
102
+ type 'autorequire=', '() -> '
103
+ type 'bin_dir', '() -> '
104
+ type 'bin_file', '() -> '
105
+ type 'bindir', '() -> '
106
+ type 'bindir=', '() -> '
107
+ type 'build_args', '() -> '
108
+ type 'build_extensions', '() -> '
109
+ type 'build_info_dir', '() -> '
110
+ type 'build_info_file', '() -> '
111
+ type 'bundled_gem_in_old_ruby?', '() -> '
112
+ type 'cache_dir', '() -> '
113
+ type 'cache_file', '() -> '
114
+ type 'cert_chain', '() -> '
115
+ type 'cert_chain=', '() -> '
116
+ type 'check_version_conflict', '() -> '
117
+ type 'conflicts', '() -> '
118
+ type 'date', '() -> '
119
+ type 'date=', '() -> '
120
+ type 'default_executable', '() -> '
121
+ type 'default_executable=', '() -> '
122
+ type 'default_value', '() -> '
123
+ type 'dependencies', '() -> '
124
+ type 'dependent_gems', '() -> '
125
+ type 'dependent_specs', '() -> '
126
+ type 'description', '() -> '
127
+ type 'description=', '() -> '
128
+ type 'development_dependencies', '() -> '
129
+ type 'doc_dir', '() -> '
130
+ type 'email', '() -> '
131
+ type 'email=', '() -> '
132
+ type 'encode_with', '() -> '
133
+ type 'eql?', '() -> '
134
+ type 'executable', '() -> '
135
+ type 'executable=', '() -> '
136
+ type 'executables', '() -> '
137
+ type 'executables=', '() -> '
138
+ type 'extensions', '() -> '
139
+ type 'extensions=', '() -> '
140
+ type 'extra_rdoc_files', '() -> '
141
+ type 'extra_rdoc_files=', '() -> '
142
+ type 'file_name', '() -> '
143
+ type 'files', '() -> '
144
+ type 'files=', '() -> '
145
+ type 'find_all_satisfiers', '() -> '
146
+ type 'find_full_gem_path', '() -> '
147
+ type 'for_cache', '() -> '
148
+ type 'full_name', '() -> '
149
+ type 'gem_build_complete_path', '() -> '
150
+ type 'gem_dir', '() -> '
151
+ type 'has_rdoc', '() -> '
152
+ type 'has_rdoc=', '() -> '
153
+ type 'has_rdoc?', '() -> '
154
+ type 'has_test_suite?', '() -> '
155
+ type 'has_unit_tests?', '() -> '
156
+ type 'hash', '() -> '
157
+ type 'homepage', '() -> '
158
+ type 'homepage=', '() -> '
159
+ type 'init_with', '() -> '
160
+ type 'initialize', '() -> '
161
+ type 'initialize_copy', '() -> '
162
+ type 'inspect', '() -> '
163
+ type 'installed_by_version', '() -> '
164
+ type 'installed_by_version=', '() -> '
165
+ type 'invalidate_memoized_attributes', '() -> '
166
+ type 'lib_dirs_glob', '() -> '
167
+ type 'lib_files', '() -> '
168
+ type 'license', '() -> '
169
+ type 'license=', '() -> '
170
+ type 'licenses', '() -> '
171
+ type 'licenses=', '() -> '
172
+ type 'loaded_from=', '() -> '
173
+ type 'mark_version', '() -> '
174
+ type 'matches_for_glob', '() -> '
175
+ type 'metadata', '() -> '
176
+ type 'metadata=', '() -> '
177
+ type 'method_missing', '() -> '
178
+ type 'missing_extensions?', '() -> '
179
+ type 'name', '() -> '
180
+ type 'name=', '() -> '
181
+ type 'name_tuple', '() -> '
182
+ type 'normalize', '() -> '
183
+ type 'original_name', '() -> '
184
+ type 'original_platform', '() -> '
185
+ type 'original_platform=', '() -> '
186
+ type 'platform', '() -> '
187
+ type 'platform=', '() -> '
188
+ type 'post_install_message', '() -> '
189
+ type 'post_install_message=', '() -> '
190
+ type 'pretty_print', '() -> '
191
+ type 'raise_if_conflicts', '() -> '
192
+ type 'rdoc_options', '() -> '
193
+ type 'rdoc_options=', '() -> '
194
+ type 'require_path', '() -> '
195
+ type 'require_path=', '() -> '
196
+ type 'require_paths=', '() -> '
197
+ type 'required_ruby_version', '() -> '
198
+ type 'required_ruby_version=', '() -> '
199
+ type 'required_rubygems_version', '() -> '
200
+ type 'required_rubygems_version=', '() -> '
201
+ type 'requirements', '() -> '
202
+ type 'requirements=', '() -> '
203
+ type 'reset_nil_attributes_to_default', '() -> '
204
+ type 'respond_to_missing?', '() -> '
205
+ type 'ri_dir', '() -> '
206
+ type 'ruby_code', '() -> '
207
+ type 'rubyforge_project', '() -> '
208
+ type 'rubyforge_project=', '() -> '
209
+ type 'rubygems_version', '() -> '
210
+ type 'rubygems_version=', '() -> '
211
+ type 'runtime_dependencies', '() -> '
212
+ type 'same_attributes?', '() -> '
213
+ type 'satisfies_requirement?', '() -> '
214
+ type 'signing_key', '() -> '
215
+ type 'signing_key=', '() -> '
216
+ type 'sort_obj', '() -> '
217
+ type 'source', '() -> '
218
+ type 'spec_dir', '() -> '
219
+ type 'spec_file', '() -> '
220
+ type 'spec_name', '() -> '
221
+ type 'specification_version', '() -> '
222
+ type 'specification_version=', '() -> '
223
+ type 'stubbed?', '() -> '
224
+ type 'summary', '() -> '
225
+ type 'summary=', '() -> '
226
+ type 'test_file', '() -> '
227
+ type 'test_file=', '() -> '
228
+ type 'test_files', '() -> '
229
+ type 'test_files=', '() -> '
230
+ type 'to_ruby', '() -> '
231
+ type 'to_ruby_for_cache', '() -> '
232
+ type 'to_s', '() -> '
233
+ type 'to_spec', '() -> '
234
+ type 'to_yaml', '() -> '
235
+ type 'traverse', '() -> '
236
+ type 'validate', '() -> '
237
+ type 'validate_dependencies', '() -> '
238
+ type 'validate_permissions', '() -> '
239
+ type 'version', '() -> '
240
+ type 'version=', '() -> '
241
+ type 'warning', '() -> '
242
+ type 'yaml_initialize', '() -> '
243
+ end
244
+ =end
245
+ end
@@ -0,0 +1,72 @@
1
+ class Hash
2
+ nowrap
3
+
4
+ type_params [:k, :v], :all?
5
+
6
+ type 'self.[]', '(Array<Array<u>>) -> Hash<u, u>'
7
+
8
+ type :[], '(k) -> v'
9
+ type :[]=, '(k, v) -> v'
10
+ type :store, '(k,v) -> v'
11
+
12
+ # type :assoc, '(k) -> [k, v]' # TODO
13
+ type :assoc, '(k) -> Array<k or v>'
14
+ type :clear, '() -> Hash<k,v>'
15
+ type :compare_by_identity, '() -> Hash<k,v>'
16
+ type :compare_by_identity?, '() -> %bool'
17
+ type :default, '(?k) -> v'
18
+ type :default, '(k) {(k) -> v} -> v'
19
+ type :default=, '(v) -> v'
20
+
21
+ # TODO: check on default_proc
22
+ #type :default_proc, '() -> (Hash<k,v>,k) -> v'
23
+ #type :default_proc=, '((Hash<k,v>,k) -> v) -> (Hash<k,v>,k) -> v'
24
+
25
+ type :delete, '(k) -> v'
26
+ type :delete, '(k) { (k) -> u } -> u or v'
27
+ type :delete_if, '() { (k,v) -> %bool } -> Hash<k,v>'
28
+ type :delete_if, '() -> Enumerator<[k, v]>'
29
+ type :each, '() { (k,v) -> %any } -> Hash<k,v>'
30
+ type :each, '() -> Enumerator<[k, v]>'
31
+ type :each_pair, '() { (k,v) -> %any } -> Hash<k,v>'
32
+ type :each_pair, '() -> Enumerator<[k, v]>'
33
+ type :each_key, '() { (k) -> %any } -> Hash<k,v>'
34
+ type :each_key, '() -> Enumerator<[k, v]>'
35
+ type :each_value, '() { (v) -> %any } -> Hash<k,v>'
36
+ type :each_value, '() -> Enumerator<[k, v]>'
37
+ type :empty?, '() -> %bool'
38
+ type :fetch, '(k) -> v'
39
+ type :fetch, '(k,u) -> u or v'
40
+ type :fetch, '(k) { (k) -> u } -> u or v'
41
+ type :member?, '(t) -> %bool'
42
+ type :has_key?, '(t) -> %bool'
43
+ type :key?, '(t) -> %bool'
44
+ type :has_value?, '(t) -> %bool'
45
+ type :value?, '(t) -> %bool'
46
+ type :to_s, '() -> String'
47
+ type :inspect, '() -> String'
48
+ type :invert, '() -> Hash<v,k>'
49
+ type :keep_if, '() { (k,v) -> %bool } -> Hash<k,v>'
50
+ type :keep_if, '() -> Enumerator<[k, v]>'
51
+ type :key, '(t) -> k'
52
+ type :keys, '() -> Array<k>'
53
+ type :length, '() -> Fixnum'
54
+ type :size, '() -> Fixnum'
55
+ type :merge, '(Hash<a,b>) -> Hash<a or k, b or v>'
56
+ type :merge, '(Hash<a,b>) { (k,v,b) -> v or b } -> Hash<a or k, b or v>'
57
+ # type :rassoc, '(k) -> Tuple<k,v>'
58
+ type :rassoc, '(k) -> Array<k or v>'
59
+ type :rehash, '() -> Hash<k,v>'
60
+ type :reject, '() -> Enumerator<[k, v]>'
61
+ type :reject, '() {(k,v) -> %bool} -> Hash<k,v>'
62
+ type :reject!, '() {(k,v) -> %bool} -> Hash<k,v>'
63
+ type :select, '() {(k,v) -> %bool} -> Hash<k,v>'
64
+ type :select!, '() {(k,v) -> %bool} -> Hash<k,v>'
65
+ # type :shift, '() -> Tuple<k,v>'
66
+ type :shift, '() -> Array<k or v>'
67
+ # type :to_a, '() -> Array<Tuple<k,v>>'
68
+ type :to_a, '() -> Array<Array<k or v>>'
69
+ type :to_hash, '() -> Hash<k,v>'
70
+ type :values, '() -> Array<v>'
71
+ type :values_at, '(*k) -> Array<v>'
72
+ end
@@ -0,0 +1,31 @@
1
+ class Integer
2
+ nowrap
3
+
4
+ rdl_alias :ceil, :to_i
5
+ type :chr, '(?Encoding) -> String'
6
+ type :denominator, '() -> 1'
7
+ type :downto, '(Integer limit) { (Integer) -> %any } -> self'
8
+ type :downto, '(Integer limit) -> Enumerator<Integer>'
9
+ type :even?, '() -> %bool'
10
+ type :gcd, '(Integer) -> Integer'
11
+ type :gcdlcm, '(Integer) -> [Integer, Integer]'
12
+ rdl_alias :floor, :to_i
13
+ type :integer?, '() -> TrueClass'
14
+ type :lcm, '(Integer) -> Integer'
15
+ type :next, '() -> Integer'
16
+ type :numerator, '() -> self'
17
+ type :odd?, '() -> %bool'
18
+ type :ord, '() -> self'
19
+ type :pred, '() -> Integer'
20
+ type :rationalize, '(?%any eps) -> Rational'
21
+ type :round, '(?Fixnum ndigits) -> Integer or Float'
22
+ rdl_alias :succ, :next
23
+ type :times, '() { (Integer) -> %any } -> self'
24
+ type :times, '() -> Enumerator<Integer>'
25
+ type :to_i, '() -> Integer'
26
+ rdl_alias :to_int, :to_i
27
+ type :to_r, '() -> Rational'
28
+ rdl_alias :truncate, :to_i
29
+ type :upto, '(Integer limit) { (Integer) -> %any } -> self'
30
+ type :upto, '(Integer limit) -> Enumerator<Integer>'
31
+ end
@@ -0,0 +1,103 @@
1
+ class IO
2
+ nowrap # Do not wrap this class. Leads to mysterious errors.
3
+
4
+ type 'self.binread', '(String name, ?Fixnum length, ?Fixnum offset) -> String'
5
+ type 'self.binwrite', '(String name, String, ?Fixnum offset, %open_args) -> Fixnum'
6
+ type 'self.copy_stream', '(String or IO src, String or IO dst, ?Fixnum copy_length, ?Fixnum src_offset) -> Fixnum'
7
+ rdl_alias 'self.for_fd', 'self.new'
8
+ type 'self.foreach', '(String name, ?String sep, ?Fixnum limit, %open_args) { (String) -> %any } -> nil'
9
+ type 'self.foreach', '(String name, ?String sep, ?Fixnum limit, %open_args) -> Enumerator<String>'
10
+ type 'self.new', '(Fixnum fd, ?Fixnum mode, ?Fixnum opt) -> IO'
11
+ type 'self.open', '(Fixnum fd, ?String mode, %open_args) -> IO'
12
+ type 'self.open', '(Fixnum fd, ?String mode, %open_args) { (IO) -> t } -> t'
13
+ type 'self.pipe', '(?String ext_or_ext_int_enc, %open_args) -> [IO, IO]'
14
+ type 'self.pipe', '(?String ext_enc, ?String int_enc, %open_args) -> [IO, IO]'
15
+ type 'self.pipe', '(?String ext_or_ext_int_enc, %open_args) { ([IO, IO]) -> t } -> t'
16
+ type 'self.pipe', '(?String ext_enc, ?String int_enc, %open_args) { ([IO, IO]) -> t } -> t'
17
+ type 'self.popen', '(?Hash<String, String> env, String cmd, ?String mode, %open_args) -> IO'
18
+ type 'self.popen', '(?Hash<String, String> env, String cmd, ?String mode, %open_args) { (IO) -> t } -> t'
19
+ type 'self.read', '(String name, ?Fixnum length, ?Fixnum offset, %open_args) -> String'
20
+ type 'self.readlines', '(String name, ?String sep, ?Fixnum limit, %open_args) -> Array<String>'
21
+ type 'self.select', '(Array<IO> read_array, ?Array<IO> write_array, ?Array<IO> error_array, ?Fixnum timeout) -> Array<IO> or nil'
22
+ type 'self.sysopen', '(String path, ?String mode, ?String perm) -> Fixnum' # TODO unsure of type of perm
23
+ type 'self.try_convert', '([to_io: () -> IO]) -> IO or nil'
24
+ type 'self.write', '(String name, String, ?Fixnum offset, %open_args) -> Fixnum'
25
+ type :<<, '([to_s: () -> String]) -> self'
26
+ type :advise, '(:normal or :sequence or :random or :willneed or :dontneed or :noreuse, ?Fixnum offset, ?Fixnum len) -> nil'
27
+ type :autoclose=, '(%bool) -> %bool'
28
+ type :autoclose?, '() -> %bool'
29
+ type :binmode, '() -> self'
30
+ type :binmode?, '() -> %bool'
31
+ rdl_alias :bytes, :each_byte # deprecated
32
+ rdl_alias :chars, :each_char # deprecated
33
+ type :close, '() -> nil'
34
+ type :close_on_exec=, '(%bool) -> %bool'
35
+ type :close_on_exec?, '() -> %bool'
36
+ type :close_read, '() -> nil'
37
+ type :close_write, '() -> nil'
38
+ type :closed?, '() -> %bool'
39
+ rdl_alias :codepoints, :each_codepoint # deprecated
40
+ type :each, '(?String sep, ?Fixnum limit) { (String) -> %any } -> self'
41
+ type :each, '(?String sep, ?Fixnum limit) -> Enumerator<String>'
42
+ rdl_alias :each_line, :each
43
+ type :each_byte, '() { (Fixnum) -> %any } -> self'
44
+ type :each_byte, '() -> Enumerator<Fixnum>'
45
+ type :each_char, '() { (String) -> %any } -> self'
46
+ type :each_char, '() -> Enumerator<String>'
47
+ type :each_codepoint, '() { (Fixnum) -> %any } -> self'
48
+ type :each_codepoint, '() -> Enumerator<Fixnum>'
49
+ type :eof, '() -> %bool'
50
+ rdl_alias :eof?, :eof
51
+ type :external_enconding, '() -> Enconding'
52
+ type :fcntl, '(Fixnum integer_cmd, String or Fixnum arg) -> Fixnum'
53
+ type :fdatasync, '() -> 0 or nil'
54
+ type :fileno, '() -> Fixnum'
55
+ type :flush, '() -> self'
56
+ type :fsync, '() -> 0 or nil'
57
+ type :getbyte, '() -> Fixnum or nil'
58
+ type :getc, '() -> String or nil'
59
+ type :gets, '(?String sep, ?Fixnum limit) -> String or nil'
60
+ type :inspect, '() -> String'
61
+ type :internal_encoding, '() -> Encoding'
62
+ type :ioctl, '(Fixnum integer_cmd, String or Fixnum arg) -> Fixnum'
63
+ type :isatty, '() -> %bool'
64
+ type :lineno, '() -> Fixnum'
65
+ type :lineno=, '(Fixnum) -> Fixnum'
66
+ rdl_alias :lines, :each_line # deprecated
67
+ type :pid, '() -> Fixnum'
68
+ type :pos, '() -> Fixnum'
69
+ type :pos=, '(Fixnum) -> Fixnum'
70
+ type :print, '(*[to_s: () -> String]) -> nil'
71
+ type :printf, '(String format_string, *%any) -> nil'
72
+ type :putc, '(Numeric or String) -> %any'
73
+ type :puts, '(*[to_s: () -> String]) -> nil'
74
+ type :read, '(?Fixnum length, ?String outbuf) -> String or nil'
75
+ type :read_nonblock, '(Fixnum maxlen) -> String'
76
+ type :read_nonblock, '(Fixnum maxlen, String outbuf) -> String outbuf'
77
+ type :readbyte, '() -> Fixnum'
78
+ type :readchar, '() -> String'
79
+ type :readline, '(?String sep, ?Fixnum limit) -> String'
80
+ type :readlines, '(?String sep, ?Fixnum limit) -> Array<String>'
81
+ type :readpartial, '(Fixnum maxlen) -> String'
82
+ type :readpartial, '(Fixnum maxlen, String outbuf) -> String outbuf'
83
+ type :reopen, '(IO other_IO) -> IO'
84
+ type :reopen, '(String path, String mode_str) -> IO'
85
+ type :rewrind, '() -> 0'
86
+ type :seek, '(Fixnum amount, ?Fixnum whence) -> 0'
87
+ type :set_encoding, '(?String or Encoding ext_or_ext_int_enc) -> self'
88
+ type :set_encoding, '(?String or Encoding ext_enc, ?String or Encoding int_enc) -> self'
89
+ type :stat, '() -> File::Stat'
90
+ type :sync, '() -> %bool'
91
+ type :sync=, '(%bool) -> %bool'
92
+ type :sysread, '(Fixnum maxlen, String outbuf) -> String'
93
+ type :sysseek, '(Fixnum amount, ?Fixnum whence) -> Fixnum'
94
+ type :syswrite, '(String) -> Fixnum'
95
+ type :tell, '() -> Fixnum'
96
+ rdl_alias :to_i, :fileno
97
+ type :to_io, '() -> self'
98
+ type :tty?, '() -> %bool'
99
+ type :ungetbyte, '(String or Fixnum) -> nil'
100
+ type :ungetc, '(String) -> nil'
101
+ type :write, '(String) -> Fixnum'
102
+ type :write_nonbloc, '(String, ?Fixnum options) -> Fixnum'
103
+ end