rtype-legacy 0.0.2

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.
@@ -0,0 +1,49 @@
1
+ module Rtype
2
+ class RtypeComponent
3
+ attr_accessor :annotation_mode, :annotation_type_sig, :ignoring
4
+ attr_reader :undef_methods, :old_methods
5
+
6
+ def initialize
7
+ @annotation_mode = false
8
+ @annotation_type_sig = nil
9
+ @ignoring = false
10
+ @undef_methods = {}
11
+ @old_methods = {}
12
+ end
13
+
14
+ def set_old(name, singleton, method)
15
+ @old_methods[singleton] ||= {}
16
+ @old_methods[singleton][name] = method
17
+ end
18
+
19
+ def get_old(name, singleton)
20
+ @old_methods[singleton][name]
21
+ end
22
+
23
+ def has_old?(name, singleton)
24
+ @old_methods.key?(singleton) && @old_methods[singleton].key?(name)
25
+ end
26
+
27
+ # @param [Symbol] name
28
+ # @param [Array] expected_args
29
+ # @param return_sig
30
+ # @param [Boolean] singleton
31
+ def add_undef(name, expected_args, return_sig, singleton)
32
+ obj = { expected: expected_args, result: return_sig }
33
+ @undef_methods[singleton] ||= {}
34
+ @undef_methods[singleton][name] = obj
35
+ end
36
+
37
+ def has_undef?(name, singleton)
38
+ @undef_methods.key?(singleton) && @undef_methods[singleton].key?(name)
39
+ end
40
+
41
+ def remove_undef(name, singleton)
42
+ @undef_methods[singleton].delete(name)
43
+ end
44
+
45
+ def get_undef(name, singleton)
46
+ @undef_methods[singleton][name]
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,10 @@
1
+ module Rtype
2
+ class TypeSignature
3
+ attr_accessor :argument_type, :return_type
4
+
5
+ # @return [Hash] A type signature
6
+ def info
7
+ {argument_type => return_type}
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ module Rtype
2
+ class TypeSignatureError < ArgumentError
3
+ end
4
+ end