rdl 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/rails_types.rb +1 -0
- data/lib/rdl.rb +56 -0
- data/lib/rdl/config.rb +121 -0
- data/lib/rdl/contracts/and.rb +29 -0
- data/lib/rdl/contracts/contract.rb +7 -0
- data/lib/rdl/contracts/flat.rb +31 -0
- data/lib/rdl/contracts/or.rb +25 -0
- data/lib/rdl/contracts/proc.rb +24 -0
- data/lib/rdl/switch.rb +20 -0
- data/lib/rdl/types/annotated_arg.rb +41 -0
- data/lib/rdl/types/finitehash.rb +81 -0
- data/lib/rdl/types/generic.rb +100 -0
- data/lib/rdl/types/intersection.rb +66 -0
- data/lib/rdl/types/lexer.rex +39 -0
- data/lib/rdl/types/lexer.rex.rb +148 -0
- data/lib/rdl/types/method.rb +219 -0
- data/lib/rdl/types/nil.rb +50 -0
- data/lib/rdl/types/nominal.rb +80 -0
- data/lib/rdl/types/optional.rb +54 -0
- data/lib/rdl/types/parser.racc +150 -0
- data/lib/rdl/types/parser.tab.rb +654 -0
- data/lib/rdl/types/singleton.rb +62 -0
- data/lib/rdl/types/structural.rb +72 -0
- data/lib/rdl/types/top.rb +50 -0
- data/lib/rdl/types/tuple.rb +61 -0
- data/lib/rdl/types/type.rb +24 -0
- data/lib/rdl/types/type_inferencer.rb +73 -0
- data/lib/rdl/types/union.rb +74 -0
- data/lib/rdl/types/var.rb +51 -0
- data/lib/rdl/types/vararg.rb +54 -0
- data/lib/rdl/types/wild.rb +26 -0
- data/lib/rdl/util.rb +56 -0
- data/lib/rdl/wrap.rb +505 -0
- data/lib/rdl_types.rb +2 -0
- data/types/other/chronic.rb +5 -0
- data/types/other/paperclip_attachment.rb +7 -0
- data/types/other/securerandom.rb +4 -0
- data/types/rails-4.2.1/fixnum.rb +3 -0
- data/types/rails-4.2.1/string.rb +3 -0
- data/types/rails-tmp/action_dispatch.rb +406 -0
- data/types/rails-tmp/active_record.rb +406 -0
- data/types/rails-tmp/devise_contracts.rb +216 -0
- data/types/ruby-2.2.0/_aliases.rb +4 -0
- data/types/ruby-2.2.0/abbrev.rb +5 -0
- data/types/ruby-2.2.0/array.rb +137 -0
- data/types/ruby-2.2.0/base64.rb +10 -0
- data/types/ruby-2.2.0/basic_object.rb +13 -0
- data/types/ruby-2.2.0/benchmark.rb +11 -0
- data/types/ruby-2.2.0/bigdecimal.rb +15 -0
- data/types/ruby-2.2.0/bigmath.rb +12 -0
- data/types/ruby-2.2.0/class.rb +17 -0
- data/types/ruby-2.2.0/complex.rb +42 -0
- data/types/ruby-2.2.0/coverage.rb +6 -0
- data/types/ruby-2.2.0/csv.rb +5 -0
- data/types/ruby-2.2.0/date.rb +6 -0
- data/types/ruby-2.2.0/dir.rb +38 -0
- data/types/ruby-2.2.0/encoding.rb +23 -0
- data/types/ruby-2.2.0/enumerable.rb +98 -0
- data/types/ruby-2.2.0/enumerator.rb +26 -0
- data/types/ruby-2.2.0/exception.rb +15 -0
- data/types/ruby-2.2.0/file.rb +124 -0
- data/types/ruby-2.2.0/fileutils.rb +6 -0
- data/types/ruby-2.2.0/fixnum.rb +45 -0
- data/types/ruby-2.2.0/float.rb +54 -0
- data/types/ruby-2.2.0/gem.rb +245 -0
- data/types/ruby-2.2.0/hash.rb +72 -0
- data/types/ruby-2.2.0/integer.rb +31 -0
- data/types/ruby-2.2.0/io.rb +103 -0
- data/types/ruby-2.2.0/kernel.rb +89 -0
- data/types/ruby-2.2.0/marshal.rb +5 -0
- data/types/ruby-2.2.0/matchdata.rb +26 -0
- data/types/ruby-2.2.0/math.rb +53 -0
- data/types/ruby-2.2.0/numeric.rb +46 -0
- data/types/ruby-2.2.0/object.rb +73 -0
- data/types/ruby-2.2.0/pathname.rb +106 -0
- data/types/ruby-2.2.0/process.rb +127 -0
- data/types/ruby-2.2.0/random.rb +15 -0
- data/types/ruby-2.2.0/range.rb +38 -0
- data/types/ruby-2.2.0/rational.rb +31 -0
- data/types/ruby-2.2.0/regexp.rb +30 -0
- data/types/ruby-2.2.0/set.rb +58 -0
- data/types/ruby-2.2.0/string.rb +145 -0
- data/types/ruby-2.2.0/strscan.rb +7 -0
- data/types/ruby-2.2.0/symbol.rb +29 -0
- data/types/ruby-2.2.0/time.rb +68 -0
- data/types/ruby-2.2.0/uri.rb +18 -0
- data/types/ruby-2.2.0/yaml.rb +5 -0
- metadata +131 -0
@@ -0,0 +1,216 @@
|
|
1
|
+
require'rdl'
|
2
|
+
|
3
|
+
module MapperHelper
|
4
|
+
class << self
|
5
|
+
attr_accessor :namespace_stack
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.devise_for_info_valid?(model, type, action, routes, path_prefix)
|
9
|
+
ctrl_cls = model.to_s.pluralize.camelize + "Controller"
|
10
|
+
ctrl_cls = eval(ctrl_cls)
|
11
|
+
|
12
|
+
info = get_devise_for_info(model, type, action, path_prefix)
|
13
|
+
path_helper_method = info[:path_helper][0]
|
14
|
+
url_helper_method = info[:url_helper][0]
|
15
|
+
path_helper_method_type = info[:path_helper][0]
|
16
|
+
url_helper_method_type = info[:url_helper][0]
|
17
|
+
path = info[:path]
|
18
|
+
verb = info[:verb]
|
19
|
+
ctrl = info[:controller]
|
20
|
+
|
21
|
+
# TODO: this part should be in post_task, but need a better way to
|
22
|
+
# take care of shared code?
|
23
|
+
|
24
|
+
# typesig(ctrl_cls, path_helper_method, path_helper_method_type)
|
25
|
+
# typesig(ctrl_cls, url_helper_method, url_helper_method_type)
|
26
|
+
|
27
|
+
route_added = routes.any? {|r|
|
28
|
+
defaults = r.defaults
|
29
|
+
route_path = r.path.spec.to_s.split('(')[0]
|
30
|
+
|
31
|
+
route_path == path and verb.include?(r.verb) and
|
32
|
+
defaults[:action] == action.to_s and defaults[:controller] == ctrl
|
33
|
+
}
|
34
|
+
|
35
|
+
ctrl_cls.instance_methods.include?(path_helper_method) and
|
36
|
+
ctrl_cls.instance_methods.include?(url_helper_method) and
|
37
|
+
route_added
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.get_devise_for_info(model, type, action, path_prefix="")
|
41
|
+
# TODO: the arg types may be (*Hash), where each Hash is a user_session?
|
42
|
+
# where is this defined?
|
43
|
+
|
44
|
+
model_s = model.to_s.singularize
|
45
|
+
model_s_c = model_s.camelize
|
46
|
+
|
47
|
+
ns = MapperHelper.namespace_stack
|
48
|
+
namespace_str = ns.empty? ? "" : ns.join("_") + "_"
|
49
|
+
namespace_path_str = ns.empty? ? "" : ns.join("/") + "/"
|
50
|
+
ctrl_prefix = namespace_path_str == "" ? "devise/" : namespace_path_str
|
51
|
+
|
52
|
+
case type
|
53
|
+
when :session
|
54
|
+
case action
|
55
|
+
when :new
|
56
|
+
h = :"new_#{namespace_str}#{model_s}_session"
|
57
|
+
v = [/^GET$/]
|
58
|
+
p = "#{path_prefix}/#{model}/sign_in"
|
59
|
+
pht = "(?Hash) -> String"
|
60
|
+
when :create
|
61
|
+
h = :"#{namespace_str}#{model_s}_session"
|
62
|
+
v = [/^POST$/]
|
63
|
+
p = "#{path_prefix}/#{model}/sign_in"
|
64
|
+
pht = "(?Hash) -> String"
|
65
|
+
when :destroy
|
66
|
+
h = :"destroy_#{namespace_str}#{model_s}_session"
|
67
|
+
v = [/^DELETE$/]
|
68
|
+
p = "#{path_prefix}/#{model}/sign_out"
|
69
|
+
# TODO: Is there a better way to specify arg is a user session?
|
70
|
+
pht = "(?Hash) -> String"
|
71
|
+
else
|
72
|
+
raise Exception, "invalid action for #{type.inspect}"
|
73
|
+
end
|
74
|
+
|
75
|
+
controller = "#{ctrl_prefix}sessions"
|
76
|
+
when :password
|
77
|
+
case action
|
78
|
+
when :new
|
79
|
+
h = :"new_#{namespace_str}#{model_s}_password"
|
80
|
+
v = [/^GET$/]
|
81
|
+
p = "#{path_prefix}/#{model}/password/new"
|
82
|
+
pht = "(?Hash) -> String"
|
83
|
+
when :edit
|
84
|
+
h = :"edit_#{namespace_str}#{model_s}_password"
|
85
|
+
v = [/^GET$/]
|
86
|
+
p = "#{path_prefix}/#{model}/password/edit"
|
87
|
+
pht = "(?Hash) -> String"
|
88
|
+
when :update
|
89
|
+
h = :"#{namespace_str}#{model_s}_password"
|
90
|
+
v = [/^PUT$/]
|
91
|
+
p = "#{path_prefix}/#{model}/password"
|
92
|
+
pht = "(?Hash) -> String"
|
93
|
+
when :create
|
94
|
+
h = :"#{namespace_str}#{model_s}_password"
|
95
|
+
v = [/^POST$/]
|
96
|
+
p = "#{path_prefix}/#{model}/password"
|
97
|
+
pht = "(?Hash) -> String"
|
98
|
+
else
|
99
|
+
raise Exception, "invalid action for #{type.inspect}"
|
100
|
+
end
|
101
|
+
|
102
|
+
controller = "#{ctrl_prefix}passwords"
|
103
|
+
when :confirmation
|
104
|
+
case action
|
105
|
+
when :new
|
106
|
+
h = :"new_#{namespace_str}#{model_s}_confirmation"
|
107
|
+
v = [/^GET$/]
|
108
|
+
p = "#{path_prefix}/#{model}/confirmation/new"
|
109
|
+
pht = "(?Hash) -> String"
|
110
|
+
when :show
|
111
|
+
h = :"#{namespace_str}#{model_s}_confirmation"
|
112
|
+
v = [/^GET$/]
|
113
|
+
p = "#{path_prefix}/#{model}/confirmation"
|
114
|
+
pht = "(?Hash) -> String"
|
115
|
+
when :create
|
116
|
+
h = :"#{namespace_str}#{model_s}_confirmation"
|
117
|
+
v = [/^POST$/]
|
118
|
+
p = "#{path_prefix}/#{model}/confirmation"
|
119
|
+
pht = "(?Hash) -> String"
|
120
|
+
else
|
121
|
+
raise Exception, "invalid action for #{type.inspect}"
|
122
|
+
end
|
123
|
+
|
124
|
+
controller = "#{ctrl_prefix}confirmations"
|
125
|
+
else
|
126
|
+
raise Exception, "invalid action"
|
127
|
+
end
|
128
|
+
|
129
|
+
ph = :"#{h}_path"
|
130
|
+
uh = :"#{h}_url"
|
131
|
+
uht = pht
|
132
|
+
|
133
|
+
{:verb => v, :path => p, :path_helper => [ph, pht], :url_helper => [uh, uht], :controller => controller}
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
module ActionDispatch::Routing
|
138
|
+
class Mapper
|
139
|
+
extend RDL
|
140
|
+
|
141
|
+
spec :namespace do
|
142
|
+
pre_task do |arg|
|
143
|
+
MapperHelper.namespace_stack = [] if not MapperHelper.namespace_stack
|
144
|
+
MapperHelper.namespace_stack.push(arg)
|
145
|
+
end
|
146
|
+
|
147
|
+
post_task do |ret, *arg|
|
148
|
+
MapperHelper.namespace_stack.pop
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# TODO: other valid options for devise_for
|
153
|
+
spec :devise_for do
|
154
|
+
post_cond do |ret, *args|
|
155
|
+
model = args[0].to_s
|
156
|
+
model_s = model.singularize
|
157
|
+
model_cls = eval(model_s.camelize)
|
158
|
+
|
159
|
+
if args[-1].class == Hash and args[-1].keys.include?(:path_prefix)
|
160
|
+
path_prefix = "/#{args[-1][:path_prefix]}"
|
161
|
+
else
|
162
|
+
path_prefix = ""
|
163
|
+
end
|
164
|
+
|
165
|
+
routes = Rails.application.routes.routes.to_a
|
166
|
+
|
167
|
+
# default is session
|
168
|
+
actions = [:new, :create, :destroy]
|
169
|
+
|
170
|
+
session_info_valid = actions.all? {|action|
|
171
|
+
MapperHelper.devise_for_info_valid?(model, :session, action, routes, path_prefix)
|
172
|
+
}
|
173
|
+
|
174
|
+
if model_cls.devise_modules.include?(:recoverable)
|
175
|
+
actions = [:new, :edit, :update, :create]
|
176
|
+
|
177
|
+
password_info_valid = actions.all? {|action|
|
178
|
+
MapperHelper.devise_for_info_valid?(model, :password, action, routes, path_prefix)
|
179
|
+
}
|
180
|
+
else
|
181
|
+
password_info_valid = true
|
182
|
+
end
|
183
|
+
|
184
|
+
if model_cls.devise_modules.include?(:confirmable)
|
185
|
+
actions = [:new, :show, :create]
|
186
|
+
|
187
|
+
confirmation_info_valid = actions.all? {|action|
|
188
|
+
MapperHelper.devise_for_info_valid?(model, :confirmation, action, routes, path_prefix)
|
189
|
+
}
|
190
|
+
else
|
191
|
+
confirmation_info_valid = true
|
192
|
+
end
|
193
|
+
|
194
|
+
ns = MapperHelper.namespace_stack
|
195
|
+
namespace_str = ns.empty? ? "" : ns.join("_") + "_"
|
196
|
+
|
197
|
+
helper_methods = {}
|
198
|
+
helper_methods[:"current_#{namespace_str}#{model_s}"] = "() -> #{model_cls}"
|
199
|
+
helper_methods[:"#{namespace_str}#{model_s}_signed_in?"] = "() -> %bool"
|
200
|
+
helper_methods[:"authenticate_#{namespace_str}#{model_s}!"] = "() -> #{model_cls}"
|
201
|
+
|
202
|
+
helper_info_valid = helper_methods.keys.all? {|m|
|
203
|
+
ApplicationController.instance_methods.include?(m)
|
204
|
+
}
|
205
|
+
|
206
|
+
# this should be in post_task? but how to take care of shared code
|
207
|
+
helper_methods.each {|method, type|
|
208
|
+
#add_typesig(ApplicationController, method, type)
|
209
|
+
}
|
210
|
+
|
211
|
+
session_info_valid and password_info_valid and confirmation_info_valid and helper_info_valid
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
@@ -0,0 +1,4 @@
|
|
1
|
+
type_alias '%real', 'Integer or Float or Rational'
|
2
|
+
type_alias '%string', '[to_str: () -> String]'
|
3
|
+
type_alias '%path', '%string or Pathname'
|
4
|
+
type_alias '%open_args', '{external_encoding: ?String, internal_encoding: ?String, encoding: ?String, textmode: ?%any, binmode: ?%any, autoclose: ?%any, mode: ?String}'
|
@@ -0,0 +1,137 @@
|
|
1
|
+
class Array
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
type_params [:t], :all?
|
5
|
+
|
6
|
+
type :<<, '(t) -> Array<t>'
|
7
|
+
type :[], '(Range<Fixnum>) -> Array<t>'
|
8
|
+
type :[], '(Fixnum or Float) -> t'
|
9
|
+
type :[], '(Fixnum, Fixnum) -> Array<t>'
|
10
|
+
type :&, '(Array<u>) -> Array<t>'
|
11
|
+
type :*, '(Fixnum) -> Array<t>'
|
12
|
+
type :*, '(String) -> String'
|
13
|
+
type :+, '(Enumerable<u>) -> Array<u or t>'
|
14
|
+
type :-, '(Array<u>) -> Array<u or t>'
|
15
|
+
type :slice, '(Range<Fixnum>) -> Array<t>'
|
16
|
+
type :slice, '(Fixnum) -> t'
|
17
|
+
type :slice, '(Fixnum, Fixnum) -> Array<t>'
|
18
|
+
type :[]=, '(Fixnum, t) -> t'
|
19
|
+
type :[]=, '(Fixnum, Fixnum, t) -> t'
|
20
|
+
#type :[]=, '(Fixnum, Fixnum, Array<t>) -> Array<t>'
|
21
|
+
#type :[]=, '(Range, Array<t>) -> Array<t>'
|
22
|
+
type :[]=, '(Range<Fixnum>, t) -> t'
|
23
|
+
type :assoc, '(t) -> Array<t>'
|
24
|
+
type :at, '(Fixnum) -> t'
|
25
|
+
type :clear, '() -> Array<t>'
|
26
|
+
type :map, '() {(t) ->u} -> Array<u>'
|
27
|
+
type :map, '() -> Enumerator<t>'
|
28
|
+
type :map!, '() {(t) ->u} -> Array<u>'
|
29
|
+
type :map!, '() -> Enumerator<t>'
|
30
|
+
type :collect, '() { (t) -> u } -> Array<u>'
|
31
|
+
type :collect, '() -> Enumerator<t>'
|
32
|
+
type :combination, '(Fixnum) { (Array<t>) -> %any } -> Array<t>'
|
33
|
+
type :combination, '(Fixnum) -> Enumerator<t>'
|
34
|
+
type :push, '(?t) -> Array<t>'
|
35
|
+
type :compact, '() -> Array<t>'
|
36
|
+
type :compact!, '() -> Array<t>'
|
37
|
+
type :concat, '(Array<t>) -> Array<t>'
|
38
|
+
type :count, '() -> Fixnum'
|
39
|
+
type :count, '(t) -> Fixnum'
|
40
|
+
type :count, '() { (t) -> %bool } -> Fixnum'
|
41
|
+
type :cycle, '(?Fixnum) { (t) -> %any } -> %any'
|
42
|
+
type :cycle, '(?Fixnum) -> Enumerator<t>'
|
43
|
+
type :delete, '(u) -> t'
|
44
|
+
type :delete, '(u) { () -> v } -> t or v'
|
45
|
+
type :delete_at, '(Fixnum) -> Array<t>'
|
46
|
+
type :delete_if, '() { (t) -> %bool } -> Array<t>'
|
47
|
+
type :delete_if, '() -> Enumerator<t>'
|
48
|
+
type :drop, '(Fixnum) -> Array<t>'
|
49
|
+
type :drop_while, '() { (t) -> %bool } -> Array<t>'
|
50
|
+
type :drop_while, '() -> Enumerator<t>'
|
51
|
+
type :each, '() -> Enumerator<t>'
|
52
|
+
type :each, '() { (t) -> %any } -> Array<t>'
|
53
|
+
type :each_index, '() { (Fixnum) -> %any } -> Array<t>'
|
54
|
+
type :each_index, '() -> Enumerator<t>'
|
55
|
+
type :empty?, '() -> %bool'
|
56
|
+
type :fetch, '(Fixnum) -> t'
|
57
|
+
type :fetch, '(Fixnum, u) -> u'
|
58
|
+
type :fetch, '(Fixnum) { (Fixnum) -> u } -> t or u'
|
59
|
+
type :fill, '(t) -> Array<t>'
|
60
|
+
type :fill, '(t,Fixnum,?Fixnum) -> Array<t>'
|
61
|
+
type :fill, '(t, Range<Fixnum>) -> Array<t>'
|
62
|
+
type :fill, '() { (Fixnum) -> t } -> Array<t>'
|
63
|
+
type :fill, '(Fixnum, ?Fixnum) { (Fixnum) -> t } -> Array<t>'
|
64
|
+
type :fill, '(Range<Fixnum>) { (Fixnum) -> t } -> Array<t>'
|
65
|
+
type :flatten, '() -> Array<%any>' # Can't give a more precise type
|
66
|
+
type :index, '(u) -> Fixnum'
|
67
|
+
type :index, '() { (t) -> %bool } -> Fixnum'
|
68
|
+
type :index, '() -> Enumerator<t>'
|
69
|
+
type :first, '() -> t'
|
70
|
+
type :first, '(Fixnum) -> Array<t>'
|
71
|
+
type :include?, '(u) -> %bool'
|
72
|
+
type :insert, '(Fixnum, *t) -> Array<t>'
|
73
|
+
type :inspect, '() -> String'
|
74
|
+
type :join, '(?String) -> String'
|
75
|
+
type :keep_if, '() { (t) -> %bool } -> Array<t>'
|
76
|
+
type :last, '() -> t'
|
77
|
+
type :last, '(Fixnum) -> Array<t>'
|
78
|
+
type :member, '(u) -> %bool'
|
79
|
+
type :length, '() -> Fixnum'
|
80
|
+
type :permutation, '(?Fixnum) -> Enumerator<t>'
|
81
|
+
type :permutation, '(?Fixnum) { (Array<t>) -> %any } -> Array<t>'
|
82
|
+
type :pop, '(Fixnum) -> Array<t>'
|
83
|
+
type :pop, '() -> t'
|
84
|
+
type :product, '(*Array<u>) -> Array<Array<t or u>>'
|
85
|
+
type :rassoc, '(u) -> t'
|
86
|
+
type :reject, '() { (t) -> %bool } -> Array<t>'
|
87
|
+
type :reject, '() -> Enumerator<t>'
|
88
|
+
type :reject!, '() { (t) -> %bool } -> Array<t>'
|
89
|
+
type :reject!, '() -> Enumerator<t>'
|
90
|
+
type :repeated_combination, '(Fixnum) { (Array<t>) -> %any } -> Array<t>'
|
91
|
+
type :repeated_combination, '(Fixnum) -> Enumerator<t>'
|
92
|
+
type :repeated_permutation, '(Fixnum) { (Array<t>) -> %any } -> Array<t>'
|
93
|
+
type :repeated_permutation, '(Fixnum) -> Enumerator<t>'
|
94
|
+
type :reverse, '() -> Array<t>'
|
95
|
+
type :reverse!, '() -> Array<t>'
|
96
|
+
type :reverse_each, '() { (t) -> %any } -> Array<t>'
|
97
|
+
type :reverse_each, '() -> Enumerator<t>'
|
98
|
+
type :rindex, '(u) -> t'
|
99
|
+
type :rindex, '() { (t) -> %bool } -> Fixnum'
|
100
|
+
type :rindex, '() -> Enumerator<t>'
|
101
|
+
type :rotate, '(?Fixnum) -> Array<t>'
|
102
|
+
type :rotate!, '(?Fixnum) -> Array<t>'
|
103
|
+
type :sample, '() -> t'
|
104
|
+
type :sample, '(Fixnum) -> Array<t>'
|
105
|
+
type :select, '() { (t) -> %bool } -> Array<t>'
|
106
|
+
type :select, '() -> Enumerator<t>'
|
107
|
+
type :select!, '() { (t) -> %bool } -> Array<t>'
|
108
|
+
type :select!, '() -> Enumerator<t>'
|
109
|
+
type :shift, '() -> t'
|
110
|
+
type :shift, '(Fixnum) -> Array<t>'
|
111
|
+
type :shuffle, '() -> Array<t>'
|
112
|
+
type :shuffle!, '() -> Array<t>'
|
113
|
+
rdl_alias :size, :length
|
114
|
+
rdl_alias :slice, :[]
|
115
|
+
type :slice!, '(Range<Fixnum>) -> Array<t>'
|
116
|
+
type :slice!, '(Fixnum, Fixnum) -> Array<t>'
|
117
|
+
type :slice!, '(Fixnum or Float) -> t'
|
118
|
+
type :sort, '() -> Array<t>'
|
119
|
+
type :sort, '() { (t,t) -> Fixnum } -> Array<t>'
|
120
|
+
type :sort!, '() -> Array<t>'
|
121
|
+
type :sort!, '() { (t,t) -> Fixnum } -> Array<t>'
|
122
|
+
type :sort_by!, '() { (t) -> u } -> Array<t>'
|
123
|
+
type :sort_by!, '() -> Enumerator<t>'
|
124
|
+
type :take, '(Fixnum) -> Array<t>'
|
125
|
+
type :take_while, '() { (t) ->%bool } -> Array<t>'
|
126
|
+
type :take_while, '() -> Enumerator<t>'
|
127
|
+
type :to_a, '() -> Array<t>'
|
128
|
+
type :to_ary, '() -> Array<t>'
|
129
|
+
rdl_alias :to_s, :inspect
|
130
|
+
type :transpose, '() -> Array<t>'
|
131
|
+
type :uniq, '() -> Array<t>'
|
132
|
+
type :uniq!, '() -> Array<t>'
|
133
|
+
type :unshift, '(*t) -> Array<t>'
|
134
|
+
type :values_at, '(*Range<Fixnum> or Fixnum) -> Array<t>'
|
135
|
+
type :zip, '(*Array<u>) -> Array<Array<t or u>>'
|
136
|
+
type :|, '(Array<u>) -> Array<t or u>'
|
137
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Base64
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
type 'self.decode64', '(String) -> String'
|
5
|
+
type 'self.encode64', '(String) -> String'
|
6
|
+
type 'self.strict_decode64', '(String) -> String'
|
7
|
+
type 'self.strict_encode64', '(String) -> String'
|
8
|
+
type 'self.urlsafe_decode64', '(String) -> String'
|
9
|
+
type 'self.urlsafe_encode64', '(String) -> String'
|
10
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class BasicObject
|
2
|
+
nowrap
|
3
|
+
type :==, '(%any other) -> %bool'
|
4
|
+
type :equal?, '(%any other) -> %bool'
|
5
|
+
type :!, '() -> %bool'
|
6
|
+
type :!=, '(%any other) -> %bool'
|
7
|
+
type :instance_eval, '(String, ?String filename, ?Fixnum lineno) -> %any'
|
8
|
+
type :instance_eval, '() { () -> %any } -> %any'
|
9
|
+
type :instance_exec, '(*%any args) { (*%any) -> %any } -> %any'
|
10
|
+
type :__send__, '(Symbol, *%any) -> %any obj'
|
11
|
+
rdl_alias :__id__, :object_id
|
12
|
+
type :object_id, '() -> Fixnum'
|
13
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Benchmark
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
type 'self.benchmark', '(String, ?Fixnum, ?String, *String) -> Array<Benchmark::Tms>'
|
5
|
+
type 'self.bm', '(?Fixnum, *String) { (Benchmark::Process) -> nil} -> Array<Benchmark::Tms>'
|
6
|
+
#type 'self.benchmark', '(Caption: String, Label_Width: ?Fixnum, Format: ?String, Labels: *String) -> Benchmark::Tms'
|
7
|
+
#type 'self.bm', '(Label_Width: ?Fixnum, Labels: *String) { (Benchmark::Process) -> nil} -> Array<Benchmark::Tms>'
|
8
|
+
type 'self.bmbm', '(?Fixnum label_width) { (Benchmark::Process) -> nil} -> Array<Benchmark::Tms>'
|
9
|
+
type 'self.measure', '(?String label) -> Benchmark::Tms'
|
10
|
+
type 'self.realtime', '() {(*%any) -> %any} -> Fixnum'
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class BigDecimal
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
#type 'self._load', '()'
|
5
|
+
type 'self.double_fig', '() -> Fixnum'
|
6
|
+
type 'self.limit', '(Fixnum) -> Fixnum'
|
7
|
+
type 'self.mode', '(Fixnum mode, ?(%bool or Symbol) value) -> Fixnum'
|
8
|
+
#type 'self.new', '(Integer or Float or Rational or BigDecimal or String, Fixnum) -> BigDecimal'
|
9
|
+
type 'self.save_exception_mode', '() { (*%any) -> %any } -> %any'
|
10
|
+
type 'self.save_limit', '() { (*%any) -> %any } -> %any'
|
11
|
+
type 'self.save_rounding_mode', '() { (*%any) -> %any } -> %any'
|
12
|
+
type 'self.ver', '() -> String'
|
13
|
+
|
14
|
+
# TODO
|
15
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module BigMath
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
type 'self.exp', '(Fixnum, Fixnum) -> BigDecimal'
|
5
|
+
type 'self.log', '(Fixnum, Fixnum) -> BigDecimal'
|
6
|
+
type :E, '(Fixnum) -> BigDecimal'
|
7
|
+
type :PI, '(Fixnum) -> BigDecimal'
|
8
|
+
type :atan, '(Fixnum, Fixnum) -> BigDecimal'
|
9
|
+
type :cos, '(Fixnum, Fixnum) -> BigDecimal'
|
10
|
+
type :sin, '(Fixnum, Fixnum) -> BigDecimal'
|
11
|
+
type :sqrt, '(Fixnum, Fixnum) -> BigDecimal'
|
12
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Class
|
2
|
+
nowrap
|
3
|
+
|
4
|
+
type 'allocate', '() -> %any' # Instance of class self
|
5
|
+
type 'inherited', '(Class) -> %any'
|
6
|
+
#type 'initialize', '() -> '
|
7
|
+
#type 'new', '(*%any) -> %any' #Causes two other test cases to fail
|
8
|
+
type 'superclass', '() -> Class or nil'
|
9
|
+
|
10
|
+
# type :class_eval, '() {() -> %any} -> %any'
|
11
|
+
# type :method_defined?, '(String or Symbol) -> %bool'
|
12
|
+
# type :define_method, '(String or Symbol) {(*%any) -> %any} -> Proc'
|
13
|
+
type :instance_methods, '(?%bool) -> Array<Symbol>'
|
14
|
+
type :class, '() -> Class'
|
15
|
+
type :superclass, '() -> Class'
|
16
|
+
type :name, '() -> String'
|
17
|
+
end
|