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.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE +9 -0
- data/README.md +449 -0
- data/Rakefile +12 -0
- data/lib/rtype/argument_type_error.rb +4 -0
- data/lib/rtype/behavior/and.rb +24 -0
- data/lib/rtype/behavior/base.rb +17 -0
- data/lib/rtype/behavior/core_ext.rb +160 -0
- data/lib/rtype/behavior/nilable.rb +21 -0
- data/lib/rtype/behavior/not.rb +24 -0
- data/lib/rtype/behavior/typed_array.rb +25 -0
- data/lib/rtype/behavior/xor.rb +25 -0
- data/lib/rtype/behavior.rb +12 -0
- data/lib/rtype/core_ext.rb +137 -0
- data/lib/rtype/legacy/version.rb +9 -0
- data/lib/rtype/legacy.rb +417 -0
- data/lib/rtype/method_annotator.rb +55 -0
- data/lib/rtype/return_type_error.rb +4 -0
- data/lib/rtype/rtype_component.rb +49 -0
- data/lib/rtype/type_signature.rb +10 -0
- data/lib/rtype/type_signature_error.rb +4 -0
- data/spec/rtype_legacy_spec.rb +825 -0
- data/spec/spec_helper.rb +13 -0
- metadata +112 -0
@@ -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
|