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,15 @@
1
+ class Random
2
+ nowrap
3
+
4
+ type 'self.new', '(?Integer seed) -> Random' # Floats can be passed also, but just truncated to int?
5
+ type 'self.new_seed', '() -> Integer'
6
+ type 'self.rand', '(?Integer max) -> Numeric'
7
+ type 'self.srand', '(?Integer number) -> Numeric old_seed'
8
+
9
+ type :==, '(%any) -> %bool'
10
+ type :bytes, '(Fixnum size) -> String'
11
+ type :rand, '(?(Integer or Range<Integer>) max) -> Integer'
12
+ type :rand, '(?(Float or Range<Float>) max) -> Float'
13
+ pre(:rand) { |max| max > 0 }
14
+ type :seed, '() -> Integer'
15
+ end
@@ -0,0 +1,38 @@
1
+ class Range
2
+ nowrap
3
+
4
+ type_params([:t], nil) { |t| t.member?(self.begin) && t.member?(self.end) } # TODO: And instantiated if t instantiated
5
+
6
+ # TODO: Parse error
7
+ # type 'self.new', '(begin: [<=> : (u, u) -> Fixnum], end: [<=>, (u, u) -> Fixnum], exclude_end: ?%bool) -> Range<u>'
8
+ type :==, '(%any obj) -> %bool'
9
+ type :===, '(%any obj) -> %bool'
10
+ type :begin, '() -> u'
11
+ type :bsearch, '() { (u) -> %bool } -> u or nil'
12
+ type :cover?, '(%any obj) -> %bool'
13
+ type :each, '() { (t) -> %any } -> self'
14
+ type :each, '() -> Enumerator<u>'
15
+ type :end, '() -> u'
16
+ rdl_alias :eql?, :==
17
+ type :exclude_end?, '() -> %bool'
18
+ type :first, '() -> u'
19
+ type :first, '(Fixnum n) -> Array<u>'
20
+ type :hash, '() -> Fixnum'
21
+ type :include?, '(%any obj) -> %bool'
22
+ type :inspect, '() -> String'
23
+ type :last, '() -> u'
24
+ type :last, '(Fixnum n) -> Array<u>'
25
+ type :max, '() -> u'
26
+ type :max, '() { (u, u) -> Fixnum } -> u'
27
+ type :max, '(Fixnum n) -> Array<u>'
28
+ type :max, '(Fixnum n) { (u, u) -> Fixnum } -> Array<u>'
29
+ rdl_alias :member?, :include
30
+ type :min, '() -> u'
31
+ type :min, '() { (u, u) -> Fixnum } -> u'
32
+ type :min, '(Fixnum n) -> Array<u>'
33
+ type :min, '(Fixnum n) { (u, u) -> Fixnum } -> Array<u>'
34
+ type :size, '() -> Fixnum or nil'
35
+ type :step, '(?Fixnum n) { (u) -> %any } -> self'
36
+ type :step, '(?Fixnum n) -> Enumerator<u>'
37
+ type :to_s, '() -> String'
38
+ end
@@ -0,0 +1,31 @@
1
+ class Rational
2
+ nowrap
3
+
4
+ type :*, '(Numeric) -> Numeric'
5
+ type :**, '(Numeric) -> Numeric'
6
+ type :+, '(Numeric) -> Numeric'
7
+ type :-, '(Numeric) -> Numeric'
8
+ type :/, '(Numeric) -> Numeric'
9
+ type :<=>, '(Numeric) -> -1 or 0 or 1 or nil'
10
+ type :==, '(%any object) -> %bool'
11
+ type :ceil, '() -> Integer'
12
+ type :ceil, '(Fixnum precision) -> Rational'
13
+ type :denominator, '() -> Integer'
14
+ post(:denominator) { |r, _| r > 0 }
15
+ type :fdiv, '(Numeric) -> Float'
16
+ type :floor, '() -> Integer'
17
+ type :floor, '(Fixnum precision) -> Rational'
18
+ type :inspect, '() -> String'
19
+ type :numerator, '() -> Integer'
20
+ rdl_alias :quo, :/
21
+ type :rationalize, '() -> self'
22
+ type :rationalize, '(Numeric eps) -> Rational'
23
+ type :round, '() -> Integer'
24
+ type :round, '(Fixnum precision) -> Rational'
25
+ type :to_f, '() -> Float'
26
+ type :to_i, '() -> Integer'
27
+ type :to_r, '() -> self'
28
+ type :to_s, '() -> String'
29
+ type :truncate, '() -> Integer'
30
+ type :truncate, '(Fixnum precision) -> Rational'
31
+ end
@@ -0,0 +1,30 @@
1
+ class Regexp
2
+ nowrap
3
+
4
+ type 'self.escape', '(String or Symbol) -> String'
5
+ type 'self.last_match', '() -> MatchData' # Can't wrap or screws up MatchData
6
+ type 'self.last_match', '(Fixnum) -> String'
7
+ type 'self.new', '(String, ?%any options, ?String kcode) -> Regexp'
8
+ type 'self.new', '(Regexp) -> Regexp'
9
+ rdl_alias 'self.compile', 'self.new'
10
+ rdl_alias 'self.quote', 'self.escape'
11
+ type 'self.try_convert', '(%any obj) -> Regexp or nil'
12
+ type 'self.union', '(*(Regexp or String) pats) -> Regexp'
13
+ type 'self.union', '(Array<Regexp or String> pats) -> Regexp'
14
+ type :==, '(%any other) -> %bool'
15
+ # type :===, '(%any other) -> %bool' # Can't wrap this of it messes with $1, $2, etc as well!
16
+ # type :=~, '(String str) -> Fixnum or nil' # Can't wrap this or it will mess with $1, $2, etc
17
+ type :casefold?, '() -> %bool'
18
+ type :encoding, '() -> Encoding'
19
+ rdl_alias :eql?, :==
20
+ type :fixed_encoding?, '() -> %bool'
21
+ type :hash, '() -> Fixnum'
22
+ type :inspect, '() -> String'
23
+ type :match, '(String, ?Fixnum) -> MatchData or nil'
24
+ type :named_captures, '() -> Hash<String, Array<Fixnum>>'
25
+ type :names, '() -> Array<String>'
26
+ type :options, '() -> Fixnum'
27
+ type :source, '() -> String'
28
+ type :to_s, '() -> String'
29
+ type :~, '() -> Fixnum or nil'
30
+ end
@@ -0,0 +1,58 @@
1
+ class Set
2
+ nowrap
3
+
4
+ type_params [:t], :all?
5
+
6
+ type 'self.[]', '(*u) -> Set<u>'
7
+ type 'self.new', '(?Enumerable<u> enum) -> Set<u>'
8
+
9
+ rdl_alias :&, :intersection
10
+ type :+, '(Enumerable<t> enum) -> Set<t>'
11
+ rdl_alias :-, :difference
12
+ rdl_alias :<, :proper_subset?
13
+ rdl_alias :<<, :add
14
+ rdl_alias :<=, :subset?
15
+ rdl_alias :>, :proper_superset?
16
+ rdl_alias :>=, :superset?
17
+ type :^, '(Enumerable<t> enum) -> Set<t>'
18
+ type :add, '(t o) -> self'
19
+ type :add?, '(t o) -> self or nil'
20
+ type :classify, '() { (u) -> t } -> Hash<u, Set<t>>'
21
+ type :clear, '() -> self'
22
+ rdl_alias :collect!, :map
23
+ type :delete, '(t o) -> self'
24
+ type :delete?, '(t o) -> self or nil'
25
+ type :delete_if, '() { (t) -> %bool } -> self'
26
+ type :difference, '(Enumerable<t> enum) -> Set<t>'
27
+ type :disjoint?, '(Set<t> set) -> %bool'
28
+ #?? type :divide, '() { BLOCK }'
29
+ type :each, '() { (t) -> %any } -> self'
30
+ type :each, '() -> Enumerator<t>'
31
+ type :empty?, '() -> %bool'
32
+ type :flatten!, '() -> self or nil'
33
+ post(:flatten!) { |r| (not r) || (r.none? { |x| x.is_a?(Set) }) }
34
+ type :flatten, '() -> Set'
35
+ post(:flatten) { |r| r.none? { |x| x.is_a?(Set) } }
36
+ # type :flatten_merge, '(set : XXXX, seen : ?XXXX)' #??
37
+ rdl_alias :include?, :member?
38
+ type :intersect?, '(Set<t> set) -> %bool'
39
+ type :intersection, '(Enumerable<t> enum) -> Set<t>'
40
+ type :keep_if, '() { (t) -> %bool } -> self'
41
+ rdl_alias :length, :size
42
+ type :map!, '() { (t) -> u } -> Set<u>' # !! Fix, actually changes type!
43
+ type :member?, '(t o) -> %bool'
44
+ type :merge, '(Enumerable<t> enum) -> self'
45
+ type :proper_subset?, '(Set<t> set) -> %bool'
46
+ type :proper_superset?, '(Set<t> set) -> %bool'
47
+ type :reject!, '() { (t) -> %bool } -> self or nil'
48
+ type :replace, '(Enumerable<u> enum) -> Set<u>' # !! Fix, actually changes type!
49
+ type :select!, '() { (t) -> %bool } -> self or nil'
50
+ type :size, '() -> Fixnum'
51
+ type :subset?, '(Set<t> set) -> %bool'
52
+ type :subtract, '(Enumerable<t> enum) -> self'
53
+ type :superset?, '(Set<t> set) -> %bool'
54
+ type :to_a, '() -> Array<t>'
55
+ # type :to_set, '(klass: ?Class, args : *XXXX) { BLOCK }' # ??
56
+ rdl_alias :|, :+
57
+ rdl_alias :union, :+
58
+ end
@@ -0,0 +1,145 @@
1
+ class String
2
+ nowrap
3
+
4
+ type :new, '(?String str) -> String new_str'
5
+ type :try_convert, '(Object obj) -> String or nil new_string'
6
+ type :%, '(Object) -> String'
7
+ type :*, '(Fixnum) -> String'
8
+ type :+, '(String) -> String'
9
+ type :<<, '(Object) -> String'
10
+ type :<=>, '(String other) -> Fixnum or nil ret'
11
+ type :==, '(%any) -> %bool'
12
+ type :===, '(%any) -> %bool'
13
+ # type :=~, '(Object) -> Fixnum or nil' # TODO: Wrapping this messes up $1 etc
14
+ type :[], '(Fixnum, ?Fixnum) -> String or nil'
15
+ type :[], '(Range<Fixnum> or Regexp) -> String or nil'
16
+ type :[], '(Regexp, Fixnum) -> String or nil'
17
+ type :[], '(Regexp, String) -> String or nil'
18
+ type :[], '(String) -> String or nil'
19
+ type :ascii_only?, '() -> %bool'
20
+ type :b, '() -> String'
21
+ type :bytes, '() -> Array' # TODO: bindings to parameterized (vars)
22
+ type :bytesize, '() -> Fixnum'
23
+ type :byteslice, '(Fixnum, ?Fixnum) -> String or nil'
24
+ type :byteslice, '(Range<Fixnum>) -> String or nil'
25
+ type :capitalize, '() -> String'
26
+ type :capitalize!, '() -> String or nil'
27
+ type :casecmp, '(String) -> nil or Fixnum'
28
+ type :center, '(Fixnum, ?String) -> String'
29
+ type :chars, '() -> Array' #deprecated
30
+ type :chomp, '(?String) -> String'
31
+ type :chomp!, '(?String) -> String or nil'
32
+ type :chop, '() -> String'
33
+ type :chop!, '() -> String or nil'
34
+ type :chr, '() -> String'
35
+ type :clear, '() -> String'
36
+ type :codepoints, '() -> Array<Fixnum>' # TODO
37
+ type :codepoints, '() {(?%any) -> %any} -> Array<Fixnum>' # TODO
38
+ type :concat, '(Fixnum or Object) -> String'
39
+ type :count, '(String, *String) -> Fixnum'
40
+ type :crypt, '(String) -> String'
41
+ type :delete, '(String, *String) -> String'
42
+ type :delete!, '(String, *String) -> String or nil'
43
+ type :downcase, '() -> String'
44
+ type :downcase!, '() -> String or nil'
45
+ type :dump, '() -> String'
46
+ type :each_byte, '() {(Fixnum) -> %any} -> String'
47
+ type :each_byte, '() -> Enumerator'
48
+ type :each_char, '() {(String) -> %any} -> String'
49
+ type :each_char, '() -> Enumerator'
50
+ type :each_codepoint, '() {(Fixnum) -> %any} -> String'
51
+ type :each_codepoint, '() -> Enumerator'
52
+ type :each_line, '(?String) {(Fixnum) -> %any} -> String'
53
+ type :each_line, '(?String) -> Enumerator'
54
+ type :empty?, '() -> %bool'
55
+ # type :encode, '(?Encoding, ?Encoding, *Symbol) -> String' # TODO: fix Hash arg
56
+ # type :encode!, '(Encoding, ?Encoding, *Symbol) -> String'
57
+ type :encoding, '() -> Encoding'
58
+ type :end_with?, '(*String) -> %bool'
59
+ type :eql?, '(String) -> %bool'
60
+ type :force_encoding, '(String or Encoding) -> String'
61
+ type :getbyte, '(Fixnum) -> Fixnum or nil'
62
+ # Can't wrap these, since they mess with $1 etc
63
+ type :gsub, '(Regexp or String, String) -> String'
64
+ type :gsub, '(Regexp or String, Hash) -> String'
65
+ type :gsub, '(Regexp or String) {(String) -> %any } -> String'
66
+ type :gsub, '(Regexp or String) -> Enumerator'
67
+ type :gsub, '(Regexp or String) -> String'
68
+ type :gsub!, '(Regexp or String, String) -> String or nil'
69
+ type :gsub!, '(Regexp or String) {(String) -> %any } -> String or nil'
70
+ type :gsub!, '(Regexp or String) -> Enumerator'
71
+ type :hash, '() -> Fixnum'
72
+ type :hex, '() -> Fixnum'
73
+ type :include?, '(String) -> %bool'
74
+ type :index, '(Regexp or String, ?Fixnum) -> Fixnum or nil'
75
+ type :replace, '(String) -> String'
76
+ type :insert, '(Fixnum, String) -> String'
77
+ type :inspect, '() -> String'
78
+ type :intern, '() -> Symbol'
79
+ type :length, '() -> Fixnum'
80
+ type :lines, '(?String) -> Array<String>'
81
+ type :ljust, '(Fixnum, ?String) -> String' # TODO
82
+ type :lstrip, '() -> String'
83
+ type :lstrip!, '() -> String or nil'
84
+ type :match, '(Regexp or String) -> MatchData'
85
+ type :match, '(Regexp or String, Fixnum) -> MatchData'
86
+ type :next, '() -> String'
87
+ type :next!, '() -> String'
88
+ type :oct, '() -> Fixnum'
89
+ type :ord, '() -> Fixnum'
90
+ type :partition, '(Regexp or String) -> Array<String>'
91
+ type :prepend, '(String) -> String'
92
+ type :reverse, '() -> String'
93
+ type :rindex, '(String or Regexp, ?Fixnum) -> Fixnum or nil' # TODO
94
+ type :rjust, '(Fixnum, ?String) -> String' # TODO
95
+ type :rpartition, '(String or Regexp) -> Array<String>'
96
+ type :rstrip, '() -> String'
97
+ type :rstrip!, '() -> String'
98
+ # type :scan, '(Regexp or String) -> Array<String or Array<String>>' # Can't wrap or screws up last_match
99
+ # type :scan, '(Regexp or String) {(*%any) -> %any} -> Array<String or Array<String>>'
100
+ type :scrub, '(?String) -> String'
101
+ type :scrub, '(?String) {(%any) -> %any} -> String'
102
+ type :scrub!, '(?String) -> String'
103
+ type :scrub!, '(?String) {(%any) -> %any} -> String'
104
+ type :set_byte, '(Fixnum, Fixnum) -> Fixnum'
105
+ type :size, '() -> Fixnum'
106
+ rdl_alias :slice, :[]
107
+ type :slice!, '(Fixnum, ?Fixnum) -> String or nil'
108
+ type :slice!, '(Range<Fixnum> or Regexp) -> String or nil'
109
+ type :slice!, '(Regexp, Fixnum) -> String or nil'
110
+ type :slice!, '(Regexp, String) -> String or nil'
111
+ type :slice!, '(String) -> String or nil'
112
+ type :split, '(?(Regexp or String), ?Fixnum) -> Array<String>'
113
+ type :split, '(?Fixnum) -> Array<String>'
114
+ type :squeeze, '(?String) -> String'
115
+ type :squeeze!, '(?String) -> String'
116
+ type :start_with?, '(* String) -> %bool'
117
+ type :strip, '() -> String'
118
+ type :strip!, '() -> String'
119
+ # Can't wrap these, since they mess with $1 etc
120
+ type :sub, '(Regexp or String, String or Hash) -> String'
121
+ type :sub, '(Regexp or String) {(String) -> %any} -> String'
122
+ type :sub!, '(Regexp or String, String) -> String' # TODO: Does this really not allow Hash?
123
+ type :sub!, '(Regexp or String) {(String) -> %any} -> String'
124
+ type :succ, '() -> String'
125
+ type :sum, '(?Fixnum) -> Fixnum'
126
+ type :swapcase, '() -> String'
127
+ type :swapcase!, '() -> String or nil'
128
+ type :to_c, '() -> Complex'
129
+ type :to_f, '() -> Float'
130
+ type :to_i, '(?Fixnum) -> Fixnum'
131
+ type :to_r, '() -> Rational'
132
+ type :to_s, '() -> String'
133
+ type :to_str, '() -> String'
134
+ type :to_sym, '() -> Symbol'
135
+ type :tr, '(String, String) -> String'
136
+ type :tr!, '(String, String) -> String or nil'
137
+ type :tr_s, '(String, String) -> String'
138
+ type :tr_s!, '(String, String) -> String or nil'
139
+ type :unpack, '(String) -> Array<String>'
140
+ type :upcase, '() -> String'
141
+ type :upcase!, '() -> String or nil'
142
+ type :upto, '(String, ?bool) -> Enumerator'
143
+ type :upto, '(String, ?bool) {(String) -> %any } -> String'
144
+ type :valid_encoding?, '() -> %bool'
145
+ end
@@ -0,0 +1,7 @@
1
+ class StringScanner
2
+ nowrap
3
+
4
+ type :eos?, '() -> %bool'
5
+ type :scan, '(Regexp) -> String'
6
+ type :getch, '() -> String'
7
+ end
@@ -0,0 +1,29 @@
1
+ class Symbol
2
+ nowrap
3
+
4
+ type 'self.all_symbols', '() -> Array<Symbol>'
5
+ type :<=>, '(Symbol other) -> Fixnum or nil'
6
+ type :==, '(%any obj) -> %bool'
7
+ type :=~, '(%any obj) -> Fixnum or nil'
8
+ type :[], '(Fixnum idx) -> String'
9
+ type :[], '(Fixnum b, Fixnum n) -> String'
10
+ type :[], '(Range<Fixnum>) -> String'
11
+ type :capitalize, '() -> Symbol'
12
+ type :casecmp, '(Symbol other) -> Fixnum or nil'
13
+ type :downcase, '() -> Symbol'
14
+ type :empty?, '() -> %bool'
15
+ type :encoding, '() -> Encoding'
16
+ type :id2name, '() -> String'
17
+ type :inspect, '() -> String'
18
+ type :intern, '() -> self'
19
+ type :length, '() -> Fixnum'
20
+ type :match, '(%any obj) -> Fixnum or nil'
21
+ type :succ, '() -> Symbol'
22
+ rdl_alias :size, :length
23
+ rdl_alias :slice, :[]
24
+ type :swapcase, '() -> Symbol'
25
+ type :to_proc, '() -> Proc' # TODO proc
26
+ rdl_alias :to_s, :id2name
27
+ rdl_alias :to_sym, :intern
28
+ type :upcase, '() -> Symbol'
29
+ end
@@ -0,0 +1,68 @@
1
+ class Time
2
+ nowrap
3
+
4
+ type 'self.at', '(Time) -> Time'
5
+ type 'self.at', '(Numeric seconds_with_frac) -> Time'
6
+ type 'self.at', '(Numeric seconds, Numeric microseconds_with_frac) -> Time'
7
+ type 'self.gm', '(Fixnum year, ?(Fixnum or String) month, ?Fixnum day, ?Fixnum hour, ?Fixnum min, ?Numeric sec, ?Numeric usec_with_frac) -> Time'
8
+ type 'self.local', '(Fixnum year, ?(Fixnum or String) month, ?Fixnum day, ?Fixnum hour, ?Fixnum min, ?Numeric sec, ?Numeric usec_with_frac) -> Time'
9
+ rdl_alias 'self.mktime', 'self.local'
10
+ type 'self.new', '(?Fixnum year, ?(Fixnum or String) month, ?Fixnum day, ?Fixnum hour, ?Fixnum min, ?Numeric sec, ?Numeric usec_with_frac) -> Time'
11
+ type 'self.now', '() -> Time'
12
+ type 'self.utc', '(Fixnum year, ?(Fixnum or String) month, ?Fixnum day, ?Fixnum hour, ?Fixnum min, ?Numeric sec, ?Numeric usec_with_frac) -> Time'
13
+
14
+ type :+, '(Numeric) -> Time'
15
+ type :-, '(Time) -> Float'
16
+ type :-, '(Numeric) -> Time'
17
+ type :<=>, '(Time other) -> -1 or 0 or 1 or nil'
18
+ type :asctime, '() -> String'
19
+ type :ctime, '() -> String'
20
+ type :day, '() -> Fixnum'
21
+ type :dst?, '() -> %bool'
22
+ type :eql?, '(%any) -> %bool'
23
+ type :friday?, '() -> %bool'
24
+ type :getgm, '() -> Time'
25
+ type :getlocal, '(?Fixnum utc_offset) -> Time'
26
+ type :getutc, '() -> Time'
27
+ type :gmt?, '() -> %bool'
28
+ type :gmt_offset, '() -> Fixnum'
29
+ type :gmtime, '() -> self'
30
+ rdl_alias :gmtoff, :gmt_offset
31
+ type :hash, '() -> Fixnum'
32
+ type :hour, '() -> Fixnum'
33
+ type :inspect, '() -> String'
34
+ type :isdst, '() -> %bool'
35
+ type :localtime, '(?String utc_offset) -> self'
36
+ type :mday, '() -> Fixnum'
37
+ type :min, '() -> Fixnum'
38
+ type :mon, '() -> Fixnum'
39
+ type :monday?, '() -> %bool'
40
+ rdl_alias :month, :mon
41
+ type :nsec, '() -> Fixnum'
42
+ type :round, '(Fixnum) -> Time'
43
+ type :saturday, '() -> %bool'
44
+ type :sec, '() -> Fixnum'
45
+ type :strftime, '(String) -> String'
46
+ type :subsec, '() -> Numeric'
47
+ type :succ, '() -> Time'
48
+ type :sunday?, '() -> %bool'
49
+ type :thursday?, '() -> %bool'
50
+ type :to_a, '() -> [Fixnum, Fixnum, Fixnum, Fixnum, Fixnum, Fixnum, Fixnum, Fixnum, %bool, String]'
51
+ type :to_f, '() -> Float'
52
+ type :to_i, '() -> Numeric'
53
+ type :to_r, '() -> Rational'
54
+ type :to_s, '() -> String'
55
+ type :tuesday?, '() -> %bool'
56
+ type :tv_nsec, '() -> Numeric'
57
+ type :tv_sec, '() -> Numeric'
58
+ type :tv_usec, '() -> Numeric'
59
+ type :usec, '() -> Numeric'
60
+ type :utc, '() -> self'
61
+ type :utc?, '() -> %bool'
62
+ type :utc_offset, '() -> Fixnum'
63
+ type :wday, '() -> Fixnum'
64
+ type :wednesday?, '() -> %bool'
65
+ type :yday, '() -> Fixnum'
66
+ type :year, '() -> Fixnum'
67
+ type :zone, '() -> String'
68
+ end
@@ -0,0 +1,18 @@
1
+ module URI
2
+ type 'decode_www_form', '(String, ?Encoding, ?String separator, %bool use_charset, %bool isindex) -> Array<[String,String]>'
3
+ type 'decode_www_form_component', '(String, ?Encoding) -> Array<[String,String]>'
4
+ # type 'encode_www_form', '(Array<Array<String>>, ?) -> String' #Doublesplat
5
+ # type 'encode_www_form_component', '(String, ?) -> String'
6
+ type 'extract', '(String, ?Array) { (*%any) -> %any} -> Array<String>'
7
+ type 'join', '(*String) -> URI::HTTP'
8
+ type 'parse', '(String) -> URI::HTTP'
9
+ type 'regexp', '(?Array schemes) -> Array<String>' #Assume schemes are strings
10
+ type 'scheme_list', '() -> Hash<String,Class>'
11
+ type 'split', '(String) -> Array<String or nil>'
12
+
13
+ type 'escape', '(String, *Regexp) -> String'
14
+ type 'escape', '(String, *String) -> String'
15
+ type 'unescape', '(*String) -> String'
16
+ rdl_alias 'encode', 'escape'
17
+ rdl_alias 'decode', 'unescape'
18
+ end