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.
- 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,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,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
|