orthoses 0.5.0 → 0.8.0
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/orthoses/attribute.rb +20 -18
- data/lib/orthoses/avoid_recursive_ancestor_error.rb +13 -6
- data/lib/orthoses/call_tracer.rb +14 -7
- data/lib/orthoses/constant.rb +10 -2
- data/lib/orthoses/content/environment.rb +14 -0
- data/lib/orthoses/delegate_class.rb +22 -8
- data/lib/orthoses/mixin.rb +40 -18
- data/lib/orthoses/utils.rb +25 -3
- data/lib/orthoses/version.rb +1 -1
- data/sig/orthoses/_call.rbs +1 -1
- data/sig/orthoses/attribute/hook.rbs +7 -0
- data/sig/orthoses/attribute.rbs +4 -0
- data/sig/orthoses/avoid_recursive_ancestor_error.rbs +3 -2
- data/sig/orthoses/builder/call_logable.rbs +1 -0
- data/sig/orthoses/builder.rbs +5 -0
- data/sig/orthoses/call_tracer/capture.rbs +6 -0
- data/sig/orthoses/call_tracer.rbs +3 -1
- data/sig/orthoses/const_load_error.rbs +2 -1
- data/sig/orthoses/constant.rbs +5 -2
- data/sig/orthoses/content/duplication_checker.rbs +5 -0
- data/sig/orthoses/content/environment.rbs +13 -4
- data/sig/orthoses/content/header_builder.rbs +8 -0
- data/sig/orthoses/content.rbs +11 -6
- data/sig/orthoses/create_file_by_name.rbs +2 -2
- data/sig/orthoses/delegate_class/hook.rbs +5 -0
- data/sig/orthoses/delegate_class.rbs +3 -2
- data/sig/orthoses/filter.rbs +2 -2
- data/sig/orthoses/load_rbs.rbs +2 -2
- data/sig/orthoses/mixin/hook.rbs +9 -0
- data/sig/orthoses/mixin.rbs +4 -0
- data/sig/orthoses/object_space_all.rbs +2 -2
- data/sig/orthoses/pp.rbs +2 -0
- data/sig/orthoses/rbs_prototype_rb.rbs +3 -2
- data/sig/orthoses/store.rbs +2 -0
- data/sig/orthoses/tap.rbs +2 -2
- data/sig/orthoses/utils.rbs +5 -3
- data/sig/orthoses/walk.rbs +2 -2
- data/sig/orthoses/writer.rbs +2 -2
- data/sig/orthoses.rbs +2 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2941ebbe45d7ab2dc9ad009628db52419a6a3b18a1fd1ad870164ab017bbb5e1
|
4
|
+
data.tar.gz: 5a33b4b63f62b820f4642d56661cebd393c3381363a8f727655f123568b2784b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd9a27c8a8f6752fc73c2c65b8dbb0edcb9885425667a8a067a6d56cc2bb32473db565ea41089ad0f8b26c598275afa83e2fb3bbde6f668fc095c942bb75af01
|
7
|
+
data.tar.gz: 4b6c157a129e1e3dfab42737ba1a4ba0f9c1c5ffe25defb693de3bce39f63fdcc746b155d030e273162e550ada315281553d921475bd4a333bf362a46e5a58bd
|
data/Gemfile.lock
CHANGED
data/lib/orthoses/attribute.rb
CHANGED
@@ -23,17 +23,17 @@ module Orthoses
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def call
|
26
|
-
Module.prepend(Hook)
|
26
|
+
::Module.prepend(Hook)
|
27
27
|
|
28
28
|
attr = CallTracer.new
|
29
29
|
attr_accessor = CallTracer.new
|
30
30
|
attr_reader = CallTracer.new
|
31
31
|
attr_writer = CallTracer.new
|
32
32
|
|
33
|
-
store = attr.trace(Hook.
|
34
|
-
attr_accessor.trace(Hook.
|
35
|
-
attr_reader.trace(Hook.
|
36
|
-
attr_writer.trace(Hook.
|
33
|
+
store = attr.trace(Hook.instance_method(:attr)) do
|
34
|
+
attr_accessor.trace(Hook.instance_method(:attr_accessor)) do
|
35
|
+
attr_reader.trace(Hook.instance_method(:attr_reader)) do
|
36
|
+
attr_writer.trace(Hook.instance_method(:attr_writer)) do
|
37
37
|
@loader.call
|
38
38
|
end
|
39
39
|
end
|
@@ -42,22 +42,23 @@ module Orthoses
|
|
42
42
|
|
43
43
|
store["Module"].body.delete("prepend Orthoses::Attribute::Hook")
|
44
44
|
|
45
|
-
attr.
|
46
|
-
m = method.receiver.to_s.match(/#<Class:([\w:]+)>/)
|
45
|
+
attr.captures.each do |capture|
|
46
|
+
m = capture.method.receiver.to_s.match(/#<Class:([\w:]+)>/)
|
47
47
|
if m && m[1]
|
48
48
|
receiver_name = m[1]
|
49
49
|
prefix = "self."
|
50
50
|
else
|
51
|
-
receiver_name = Utils.module_name(method.receiver) or next
|
51
|
+
receiver_name = Utils.module_name(capture.method.receiver) or next
|
52
52
|
prefix = nil
|
53
53
|
end
|
54
54
|
content = store[receiver_name]
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
names = capture.argument[:names]
|
56
|
+
if names[1].equal?(true)
|
57
|
+
content << "attr_accessor #{prefix}#{names[0]}: untyped"
|
58
|
+
elsif names[1].equal?(false)
|
59
|
+
content << "attr_reader #{prefix}#{names[0]}: untyped"
|
59
60
|
else
|
60
|
-
|
61
|
+
names.each do |name|
|
61
62
|
content << "attr_reader #{prefix}#{name}: untyped"
|
62
63
|
end
|
63
64
|
end
|
@@ -79,16 +80,17 @@ module Orthoses
|
|
79
80
|
private
|
80
81
|
|
81
82
|
def each_definition(call_tracer)
|
82
|
-
call_tracer.
|
83
|
-
m = method.receiver.to_s.match(/#<Class:([\w:]+)>/)
|
83
|
+
call_tracer.captures.each do |capture|
|
84
|
+
m = capture.method.receiver.to_s.match(/#<Class:([\w:]+)>/)
|
85
|
+
names = capture.argument[:names]
|
84
86
|
if m && m[1]
|
85
87
|
receiver_name = m[1]
|
86
|
-
|
88
|
+
names.each do |name|
|
87
89
|
yield [receiver_name, "self.#{name}"]
|
88
90
|
end
|
89
91
|
else
|
90
|
-
receiver_name = Utils.module_name(method.receiver) or next
|
91
|
-
|
92
|
+
receiver_name = Utils.module_name(capture.method.receiver) or next
|
93
|
+
names.each do |name|
|
92
94
|
yield [receiver_name, name]
|
93
95
|
end
|
94
96
|
end
|
@@ -7,16 +7,23 @@ module Orthoses
|
|
7
7
|
def call
|
8
8
|
@loader.call.tap do |store|
|
9
9
|
object_mixins = {}
|
10
|
-
store
|
11
|
-
|
12
|
-
when RBS::AST::Members::Mixin
|
13
|
-
object_mixins[member.name.relative!.to_s] = true
|
14
|
-
end
|
15
|
-
end
|
10
|
+
set_object_mixins_recursive(store, "Object", object_mixins)
|
11
|
+
|
16
12
|
object_mixins.each_key do |object_mixin|
|
17
13
|
store[object_mixin].header = "module #{object_mixin} : BasicObject"
|
18
14
|
end
|
19
15
|
end
|
20
16
|
end
|
17
|
+
|
18
|
+
def set_object_mixins_recursive(store, name, object_mixins)
|
19
|
+
store[name].to_decl.members.each do |member|
|
20
|
+
case member
|
21
|
+
when RBS::AST::Members::Mixin
|
22
|
+
member_name = member.name.relative!.to_s
|
23
|
+
object_mixins[member_name] = true
|
24
|
+
set_object_mixins_recursive(store, member_name, object_mixins)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
21
28
|
end
|
22
29
|
end
|
data/lib/orthoses/call_tracer.rb
CHANGED
@@ -7,16 +7,19 @@ module Orthoses
|
|
7
7
|
# scope.trace(ActiveRecord::Base.method(:scope)) do
|
8
8
|
# @loader.call
|
9
9
|
# end
|
10
|
-
# scope.
|
11
|
-
# argument[:name]
|
12
|
-
# argument[:body]
|
13
|
-
# argument[:block]
|
10
|
+
# scope.captures.each do |capture|
|
11
|
+
# capture.argument[:name]
|
12
|
+
# capture.argument[:body]
|
13
|
+
# capture.argument[:block]
|
14
14
|
# end
|
15
15
|
class CallTracer
|
16
|
-
|
16
|
+
class Capture < Struct.new(:method, :argument, keyword_init: true)
|
17
|
+
end
|
18
|
+
|
19
|
+
attr_accessor :captures
|
17
20
|
|
18
21
|
def initialize
|
19
|
-
@
|
22
|
+
@captures = []
|
20
23
|
end
|
21
24
|
|
22
25
|
def trace(target, &block)
|
@@ -46,7 +49,11 @@ module Orthoses
|
|
46
49
|
end
|
47
50
|
end
|
48
51
|
end
|
49
|
-
|
52
|
+
|
53
|
+
@captures << Capture.new(
|
54
|
+
method: called_method,
|
55
|
+
argument: argument,
|
56
|
+
)
|
50
57
|
end
|
51
58
|
t.enable(target: target, &block)
|
52
59
|
end
|
data/lib/orthoses/constant.rb
CHANGED
@@ -27,10 +27,14 @@ module Orthoses
|
|
27
27
|
Orthoses::Utils.each_const_recursive(base, on_error: @on_error) do |current, const, val|
|
28
28
|
next if current.singleton_class?
|
29
29
|
next if Utils.module_name(current).nil?
|
30
|
-
next if val.kind_of?(Module)
|
31
30
|
next if cache[[current, const]]
|
32
31
|
cache[[current, const]] = true
|
33
32
|
|
33
|
+
if val.kind_of?(Module)
|
34
|
+
will_add_key_and_content << [Utils.module_name(val), nil]
|
35
|
+
next
|
36
|
+
end
|
37
|
+
|
34
38
|
rbs = Orthoses::Utils.object_to_rbs(val, strict: @strict)
|
35
39
|
next unless rbs
|
36
40
|
next unless @if.nil? || @if.call(current, const, val, rbs)
|
@@ -38,8 +42,12 @@ module Orthoses
|
|
38
42
|
will_add_key_and_content << [Utils.module_name(current), "#{const}: #{rbs}"]
|
39
43
|
end
|
40
44
|
end
|
45
|
+
|
41
46
|
will_add_key_and_content.each do |name, line|
|
42
|
-
|
47
|
+
next unless name
|
48
|
+
content = store[name]
|
49
|
+
next unless line
|
50
|
+
content << line
|
43
51
|
end
|
44
52
|
end
|
45
53
|
end
|
@@ -86,15 +86,29 @@ module Orthoses
|
|
86
86
|
writer = RBS::Writer.new(out: out)
|
87
87
|
decls.each do |decl|
|
88
88
|
next unless decl.respond_to?(:members)
|
89
|
+
last_visibility = :public
|
89
90
|
decl.members.each do |member|
|
90
91
|
next if member.respond_to?(:members)
|
91
92
|
case member
|
92
93
|
when RBS::AST::Declarations::Constant
|
93
94
|
next unless @constant_filter.nil? || @constant_filter.call(member)
|
95
|
+
when RBS::AST::Members::MethodDefinition
|
96
|
+
if last_visibility == :private && member.kind != :singleton_instance
|
97
|
+
member.instance_variable_set(:@visibility, :private)
|
98
|
+
end
|
94
99
|
when RBS::AST::Members::Mixin
|
95
100
|
next unless @mixin_filter.nil? || @mixin_filter.call(member)
|
96
101
|
when RBS::AST::Members::Attribute
|
97
102
|
next unless @attribute_filter.nil? || @attribute_filter.call(member)
|
103
|
+
if last_visibility == :private
|
104
|
+
member.instance_variable_set(:@visibility, :private)
|
105
|
+
end
|
106
|
+
when RBS::AST::Members::Public
|
107
|
+
last_visibility = :public
|
108
|
+
next
|
109
|
+
when RBS::AST::Members::Private
|
110
|
+
last_visibility = :private
|
111
|
+
next
|
98
112
|
end
|
99
113
|
writer.write_member(member)
|
100
114
|
end
|
@@ -2,31 +2,44 @@
|
|
2
2
|
|
3
3
|
module Orthoses
|
4
4
|
class DelegateClass
|
5
|
+
module Hook
|
6
|
+
def inherited(subclass)
|
7
|
+
super
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
5
11
|
def initialize(loader)
|
6
12
|
@loader = loader
|
7
13
|
end
|
8
14
|
|
9
15
|
def call
|
10
16
|
require 'delegate'
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|
17
|
+
::Class.prepend(Hook)
|
18
|
+
|
19
|
+
inherited = CallTracer.new
|
20
|
+
|
17
21
|
delegate_class_super_map = {}
|
18
22
|
delegate_class_tracer = TracePoint.new(:return) do |tp|
|
19
23
|
return_value = tp.return_value
|
20
24
|
superclass = tp.binding.local_variable_get(:superclass)
|
21
25
|
delegate_class_super_map[return_value] = superclass
|
22
26
|
end
|
27
|
+
|
23
28
|
store = delegate_class_tracer.enable(target: method(:DelegateClass)) do
|
24
|
-
|
29
|
+
inherited.trace(Hook.instance_method(:inherited)) do
|
30
|
+
@loader.call
|
31
|
+
end
|
25
32
|
end
|
26
|
-
|
33
|
+
|
34
|
+
store["Class"].body.delete("prepend Orthoses::DelegateClass::Hook")
|
35
|
+
|
36
|
+
inherited.captures.each do |capture|
|
37
|
+
superclass = capture.method.receiver
|
27
38
|
if delegate_to_class = delegate_class_super_map[superclass]
|
39
|
+
subclass = capture.argument[:subclass]
|
28
40
|
subclass_name = Utils.module_name(subclass)
|
29
41
|
next unless subclass_name
|
42
|
+
|
30
43
|
delegate_to_class_name = Utils.module_name(delegate_to_class)
|
31
44
|
next unless delegate_to_class_name
|
32
45
|
|
@@ -34,6 +47,7 @@ module Orthoses
|
|
34
47
|
store[subclass_name].header = header
|
35
48
|
end
|
36
49
|
end
|
50
|
+
|
37
51
|
store
|
38
52
|
end
|
39
53
|
|
data/lib/orthoses/mixin.rb
CHANGED
@@ -2,49 +2,71 @@
|
|
2
2
|
|
3
3
|
module Orthoses
|
4
4
|
class Mixin
|
5
|
+
module Hook
|
6
|
+
def include(*modules)
|
7
|
+
super
|
8
|
+
end
|
9
|
+
def extend(*modules)
|
10
|
+
super
|
11
|
+
end
|
12
|
+
def prepend(*modules)
|
13
|
+
super
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
5
17
|
def initialize(loader, if: nil)
|
6
18
|
@loader = loader
|
7
19
|
@if = binding.local_variable_get(:if)
|
8
20
|
end
|
9
21
|
|
10
22
|
def call
|
11
|
-
|
12
|
-
::Module.module_eval do
|
13
|
-
define_method(:included) do |mod|
|
14
|
-
modules[mod] << [:include, self]
|
15
|
-
end
|
23
|
+
::Module.prepend(Hook)
|
16
24
|
|
17
|
-
|
18
|
-
|
19
|
-
|
25
|
+
include = CallTracer.new
|
26
|
+
extend = CallTracer.new
|
27
|
+
prepend = CallTracer.new
|
20
28
|
|
21
|
-
|
22
|
-
|
29
|
+
store = include.trace(Hook.instance_method(:include)) do
|
30
|
+
extend.trace(Hook.instance_method(:extend)) do
|
31
|
+
prepend.trace(Hook.instance_method(:prepend)) do
|
32
|
+
@loader.call
|
33
|
+
end
|
23
34
|
end
|
24
35
|
end
|
25
36
|
|
26
|
-
store
|
37
|
+
store["Module"].body.delete("prepend Orthoses::Mixin::Hook")
|
38
|
+
|
39
|
+
collect_definitions(store, include, :include)
|
40
|
+
collect_definitions(store, extend, :extend)
|
41
|
+
collect_definitions(store, prepend, :prepend)
|
42
|
+
|
43
|
+
store
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
27
47
|
|
28
|
-
|
48
|
+
def collect_definitions(store, call_tracer, how)
|
49
|
+
call_tracer.captures.each do |capture|
|
50
|
+
base_mod = capture.method.receiver
|
29
51
|
next unless base_mod.kind_of?(Module)
|
52
|
+
|
30
53
|
base_mod_name = Utils.module_name(base_mod)
|
31
54
|
next unless base_mod_name
|
32
55
|
|
33
|
-
|
56
|
+
content = store[base_mod_name]
|
57
|
+
capture.argument[:modules].each do |mod|
|
34
58
|
mod_name = Utils.module_name(mod)
|
35
59
|
next unless mod_name
|
60
|
+
|
36
61
|
known_type_params = Utils.known_type_params(mod)
|
37
62
|
next unless known_type_params.nil? || known_type_params.empty?
|
63
|
+
|
38
64
|
next unless @if.nil? || @if.call(base_mod, how, mod)
|
39
65
|
|
40
66
|
store[mod_name]
|
41
|
-
|
42
|
-
"#{how} #{mod_name}"
|
67
|
+
content << "#{how} #{mod_name}"
|
43
68
|
end
|
44
|
-
store[base_mod_name].concat(lines)
|
45
69
|
end
|
46
|
-
|
47
|
-
store
|
48
70
|
end
|
49
71
|
end
|
50
72
|
end
|
data/lib/orthoses/utils.rb
CHANGED
@@ -46,6 +46,28 @@ module Orthoses
|
|
46
46
|
RBS::Namespace.parse(name).to_type_name
|
47
47
|
end
|
48
48
|
|
49
|
+
class << self
|
50
|
+
# Generated scripts are not always located in the root.
|
51
|
+
# By default, it follows the upper level directory from the current directory
|
52
|
+
# to find the rbs_collection.yaml file and set it to `rbs_collection_pathname`.
|
53
|
+
# It can be reconfigured if necessary.
|
54
|
+
attr_accessor :rbs_collection_pathname
|
55
|
+
end
|
56
|
+
# set default
|
57
|
+
self.rbs_collection_pathname = ->() {
|
58
|
+
begin
|
59
|
+
start = here = Dir.pwd
|
60
|
+
until ok = RBS::Collection::Config::PATH.exist?
|
61
|
+
Dir.chdir("..")
|
62
|
+
return nil if Dir.pwd == here
|
63
|
+
here = Dir.pwd
|
64
|
+
end
|
65
|
+
Pathname(here) + RBS::Collection::Config::PATH
|
66
|
+
ensure
|
67
|
+
Dir.chdir(start)
|
68
|
+
end
|
69
|
+
}.call
|
70
|
+
|
49
71
|
def self.rbs_environment(library: nil, collection: false, cache: true)
|
50
72
|
@env_cache ||= {}
|
51
73
|
if cache && hit = @env_cache[[library, collection]]
|
@@ -54,9 +76,9 @@ module Orthoses
|
|
54
76
|
|
55
77
|
loader = RBS::EnvironmentLoader.new
|
56
78
|
|
57
|
-
if collection
|
58
|
-
|
59
|
-
loader.add_collection(
|
79
|
+
if collection && rbs_collection_pathname
|
80
|
+
config = RBS::Collection::Config.lockfile_of(rbs_collection_pathname) or raise
|
81
|
+
loader.add_collection(config)
|
60
82
|
end
|
61
83
|
|
62
84
|
case library
|
data/lib/orthoses/version.rb
CHANGED
data/sig/orthoses/_call.rbs
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
module Orthoses::Attribute::Hook
|
4
|
+
def attr: (*untyped names) -> untyped
|
5
|
+
|
6
|
+
def attr_accessor: (*untyped names) -> untyped
|
7
|
+
|
8
|
+
def attr_reader: (*untyped names) -> untyped
|
9
|
+
|
10
|
+
def attr_writer: (*untyped names) -> untyped
|
4
11
|
end
|
data/sig/orthoses/attribute.rbs
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Attribute
|
4
|
+
def initialize: (Orthoses::_Call loader) -> void
|
5
|
+
def call: () -> Orthoses::store
|
6
|
+
private def each_definition: (untyped call_tracer) { (untyped) -> untyped } -> untyped
|
7
|
+
@loader: Orthoses::_Call
|
4
8
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::AvoidRecursiveAncestorError
|
4
|
-
@loader: Orthoses::_Call
|
5
|
-
include Orthoses::_MiddleWare
|
6
4
|
def initialize: (Orthoses::_Call loader) -> void
|
5
|
+
def call: () -> Orthoses::store
|
6
|
+
def set_object_mixins_recursive: (untyped store, untyped name, untyped object_mixins) -> untyped
|
7
|
+
@loader: Orthoses::_Call
|
7
8
|
end
|
data/sig/orthoses/builder.rbs
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Builder
|
4
|
+
def initialize: () ?{ () -> untyped } -> void
|
5
|
+
def use: (untyped middleware, *untyped args, **untyped key) ?{ () -> untyped } -> untyped
|
6
|
+
def run: (untyped loader) -> untyped
|
7
|
+
def to_loader: () -> untyped
|
8
|
+
|
4
9
|
def call: () { () -> void } -> Orthoses::store
|
5
10
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::CallTracer
|
4
|
-
|
4
|
+
def initialize: () -> void
|
5
|
+
|
5
6
|
def trace: [T] (Method | UnboundMethod) ?{ () -> T } -> T
|
7
|
+
attr_accessor captures: Array[Capture]
|
6
8
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::ConstLoadError < ::StandardError
|
4
|
+
def initialize: (root: Module, const: Symbol, error: untyped) -> void
|
5
|
+
def message: () -> ::String
|
4
6
|
attr_reader root: Module
|
5
7
|
attr_reader const: Symbol
|
6
8
|
attr_reader error: untyped
|
7
|
-
def initialize: (root: Module, const: Symbol, error: untyped) -> void
|
8
9
|
end
|
data/sig/orthoses/constant.rbs
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Constant
|
4
|
+
def initialize: (Orthoses::_Call loader, strict: bool, ?if: ^(Module, Symbol, untyped) -> boolish, ?on_error: ^(Orthoses::ConstLoadError) -> void) -> void
|
5
|
+
def call: () -> Orthoses::store
|
4
6
|
@loader: Orthoses::_Call
|
5
|
-
|
6
|
-
|
7
|
+
@strict: bool
|
8
|
+
@if: ^(Module mod, Symbol const, untyped val, String rbs) -> boolish?
|
9
|
+
@on_error: ^(Orthoses::ConstLoadError) -> void | nil
|
7
10
|
end
|
@@ -1,4 +1,9 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Content::DuplicationChecker
|
4
|
+
def initialize: (untyped decl) -> void
|
5
|
+
def update_decl: () -> untyped
|
6
|
+
private def drop_known_method_definition: (untyped uniq_map) -> untyped
|
7
|
+
private def member_to_s: (untyped member) -> untyped
|
8
|
+
private def member_key: (untyped member) -> untyped
|
4
9
|
end
|
@@ -1,13 +1,22 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Content::Environment
|
4
|
+
def self.load_from_paths: (untyped paths) -> untyped
|
5
|
+
|
6
|
+
def initialize: (?constant_filter: constant_filter?, ?mixin_filter: mixin_filter?, ?attribute_filter: attribute_filter?) -> void
|
7
|
+
def <<: (RBS::AST::Declarations::t decl) -> RBS::Environment
|
8
|
+
def write_to: (store: Orthoses::store) -> void
|
9
|
+
def each: () { (Orthoses::Content) -> void } -> void
|
10
|
+
# Avoid `RBS::GenericParameterMismatchError` from like rbs_prototype_rb
|
11
|
+
# class Array # <= RBS::GenericParameterMismatchError
|
12
|
+
# end
|
13
|
+
private def avoid_generic_parameter_mismatch_error: () -> untyped
|
14
|
+
private def decls_to_lines: (untyped decls) -> untyped
|
4
15
|
type constant_filter = ^(RBS::AST::Declarations::Constant) -> boolish
|
5
16
|
type mixin_filter = ^(RBS::AST::Members::Mixin) -> boolish
|
17
|
+
type attribute_filter = ^(RBS::AST::Members::Attribute) -> boolish
|
6
18
|
@env: RBS::Environment
|
7
19
|
@constant_filter: constant_filter?
|
8
20
|
@mixin_filter: mixin_filter?
|
9
|
-
|
10
|
-
def <<: (RBS::AST::Declarations::t decl) -> RBS::Environment
|
11
|
-
def write_to: (store: Orthoses::store) -> void
|
12
|
-
def each: () { (Orthoses::Content) -> void } -> void
|
21
|
+
@attribute_filter: attribute_filter?
|
13
22
|
end
|
@@ -1,4 +1,12 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Content::HeaderBuilder
|
4
|
+
def initialize: (env: untyped) -> void
|
5
|
+
def build: (entry: untyped, ?name_hint: untyped?) -> untyped
|
6
|
+
private def build_module: (entry: untyped, ?name_hint: untyped?) -> ::String
|
7
|
+
private def build_class: (entry: untyped, ?name_hint: untyped?) -> ::String
|
8
|
+
private def build_super_class: (untyped primary) -> (nil | untyped)
|
9
|
+
private def build_interface: (entry: untyped, ?name_hint: untyped?) -> ::String
|
10
|
+
private def name_and_params: (untyped name, untyped params) -> ::String
|
11
|
+
private def name_and_args: (untyped name, untyped args) -> (::String | nil)
|
4
12
|
end
|
data/sig/orthoses/content.rbs
CHANGED
@@ -1,14 +1,19 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Content
|
4
|
-
attr_reader name: String
|
5
|
-
attr_reader body: Array[String]
|
6
|
-
attr_accessor header: String?
|
7
4
|
def initialize: (name: String) -> void
|
8
5
|
def <<: (String) -> void
|
9
6
|
def concat: (Array[String]) -> void
|
10
7
|
def to_rbs: () -> String
|
11
|
-
|
12
|
-
def
|
13
|
-
|
8
|
+
def to_decl: () -> untyped
|
9
|
+
private def original_rbs: () -> ::String
|
10
|
+
|
11
|
+
private def uniqed_body_string: () -> String
|
12
|
+
private def uniqed_body_decl: () -> RBS::AST::Declarations::t
|
13
|
+
private def auto_header: () -> (nil | untyped)
|
14
|
+
private def temporary_type_params: (untyped name) -> untyped
|
15
|
+
private def type_params: (untyped name) -> untyped
|
16
|
+
attr_reader name: String
|
17
|
+
attr_reader body: Array[String]
|
18
|
+
attr_accessor header: String?
|
14
19
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::CreateFileByName
|
4
|
-
@loader: Orthoses::_Call
|
5
|
-
include Orthoses::_MiddleWare
|
6
4
|
def initialize: (Orthoses::_Call loader, base_dir: String, ?header: String?) -> void
|
5
|
+
def call: () -> Orthoses::store
|
6
|
+
@loader: Orthoses::_Call
|
7
7
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::DelegateClass
|
4
|
-
@loader: Orthoses::_Call
|
5
|
-
include Orthoses::_MiddleWare
|
6
4
|
def initialize: (Orthoses::_Call loader) -> void
|
5
|
+
def call: () -> Orthoses::store
|
6
|
+
def temporary_type_params: (untyped name) -> untyped
|
7
|
+
@loader: Orthoses::_Call
|
7
8
|
end
|
data/sig/orthoses/filter.rbs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Filter
|
4
|
-
@loader: Orthoses::_Call
|
5
|
-
include Orthoses::_MiddleWare
|
6
4
|
def initialize: (Orthoses::_Call loader, if: ^(String, Orthoses::Content) -> boolish) -> void
|
5
|
+
def call: () -> Orthoses::store
|
6
|
+
@loader: Orthoses::_Call
|
7
7
|
end
|
data/sig/orthoses/load_rbs.rbs
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::LoadRBS
|
4
|
+
def initialize: (Orthoses::_Call loader, paths: Array[_ToS]) -> void
|
5
|
+
def call: () -> Orthoses::store
|
4
6
|
@loader: Orthoses::_Call
|
5
7
|
@paths: Array[_ToS]
|
6
|
-
include Orthoses::_MiddleWare
|
7
|
-
def initialize: (Orthoses::_Call loader, paths: Array[_ToS]) -> void
|
8
8
|
end
|
data/sig/orthoses/mixin.rbs
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Mixin
|
4
|
+
def initialize: (Orthoses::_Call loader) -> void
|
5
|
+
def call: () -> Orthoses::store
|
6
|
+
private def collect_definitions: (Orthoses::store store, Orthoses::CallTracer call_tracer, :include | :extend | :prepend how) -> void
|
7
|
+
@loader: Orthoses::_Call
|
4
8
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::ObjectSpaceAll
|
4
|
-
@loader: Orthoses::_Call
|
5
|
-
include Orthoses::_MiddleWare
|
6
4
|
def initialize: (Orthoses::_Call loader, ?if: ^(Module) -> boolish) -> void
|
5
|
+
def call: () -> Orthoses::store
|
6
|
+
@loader: Orthoses::_Call
|
7
7
|
end
|
data/sig/orthoses/pp.rbs
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::RBSPrototypeRB
|
4
|
+
def initialize: (Orthoses::_Call loader, paths: Array[_ToS], ?constant_filter: Orthoses::Content::Environment::constant_filter?, ?mixin_filter: Orthoses::Content::Environment::mixin_filter?, ?attribute_filter: Orthoses::Content::Environment::attribute_filter?) -> void
|
5
|
+
def call: () -> Orthoses::store
|
4
6
|
@loader: Orthoses::_Call
|
5
|
-
include Orthoses::_MiddleWare
|
6
|
-
def initialize: (Orthoses::_Call loader, paths: Array[_ToS], ?constant_filter: Orthoses::Content::Environment::constant_filter?, ?mixin_filter: Orthoses::Content::Environment::mixin_filter?) -> void
|
7
7
|
@paths: Array[_ToS]
|
8
8
|
@constant_filter: Orthoses::Content::Environment::constant_filter?
|
9
9
|
@mixin_filter: Orthoses::Content::Environment::mixin_filter?
|
10
|
+
@attribute_filter: Orthoses::Content::Environment::mixin_filter?
|
10
11
|
end
|
data/sig/orthoses/store.rbs
CHANGED
data/sig/orthoses/tap.rbs
CHANGED
data/sig/orthoses/utils.rbs
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Orthoses::Utils
|
4
4
|
def self.unautoload!: () -> void
|
5
5
|
|
6
|
-
def self.each_const_recursive: (Module root, ?cache: Hash[untyped, true], ?on_error: ^(Orthoses::ConstLoadError) -> void
|
6
|
+
def self.each_const_recursive: (Module root, ?cache: Hash[untyped, true], ?on_error: ^(Orthoses::ConstLoadError) -> void) ?{ (Module, Symbol, untyped) -> void } -> void
|
7
7
|
|
8
8
|
def self.rbs_defined_const?: (String name, ?library: (String | Array[String])?, ?collection: boolish) -> bool
|
9
9
|
|
@@ -11,7 +11,7 @@ module Orthoses::Utils
|
|
11
11
|
|
12
12
|
def self.rbs_type_name: (String) -> RBS::TypeName
|
13
13
|
|
14
|
-
def self.rbs_environment: (?library: String | Array[String] | nil, ?collection: boolish) -> RBS::Environment
|
14
|
+
def self.rbs_environment: (?library: String | Array[String] | nil, ?collection: boolish, ?cache: boolish) -> RBS::Environment
|
15
15
|
|
16
16
|
def self.object_to_rbs: (untyped object, strict: bool) -> String
|
17
17
|
|
@@ -19,9 +19,11 @@ module Orthoses::Utils
|
|
19
19
|
|
20
20
|
def self.module_to_type_name: (Module) -> RBS::TypeName?
|
21
21
|
|
22
|
-
def self.known_type_params: (Module | String) -> Array[RBS::AST::TypeParam]
|
22
|
+
def self.known_type_params: (Module | String) -> Array[RBS::AST::TypeParam]?
|
23
23
|
|
24
24
|
def self.new_store: () -> Orthoses::store
|
25
25
|
|
26
26
|
UNBOUND_NAME_METHOD: UnboundMethod
|
27
|
+
|
28
|
+
attr_accessor self.rbs_collection_pathname: Pathname
|
27
29
|
end
|
data/sig/orthoses/walk.rbs
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Walk
|
4
|
+
def initialize: (Orthoses::_Call loader, root: Module | String) -> void
|
5
|
+
def call: () -> Orthoses::store
|
4
6
|
@loader: Orthoses::_Call
|
5
7
|
@root: Module | String
|
6
|
-
include Orthoses::_MiddleWare
|
7
|
-
def initialize: (Orthoses::_Call loader, root: Module | String) -> void
|
8
8
|
end
|
data/sig/orthoses/writer.rbs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# THIS IS GENERATED CODE from `$ rake generate_self_sig`
|
2
2
|
|
3
3
|
class Orthoses::Writer
|
4
|
-
@loader: Orthoses::_Call
|
5
|
-
include Orthoses::_MiddleWare
|
6
4
|
def initialize: (Orthoses::_Call loader, io: _Writer) -> void
|
5
|
+
def call: () -> Orthoses::store
|
6
|
+
@loader: Orthoses::_Call
|
7
7
|
end
|
data/sig/orthoses.rbs
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orthoses
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbs
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- sig/orthoses/builder.rbs
|
74
74
|
- sig/orthoses/builder/call_logable.rbs
|
75
75
|
- sig/orthoses/call_tracer.rbs
|
76
|
+
- sig/orthoses/call_tracer/capture.rbs
|
76
77
|
- sig/orthoses/const_load_error.rbs
|
77
78
|
- sig/orthoses/constant.rbs
|
78
79
|
- sig/orthoses/content.rbs
|
@@ -81,9 +82,11 @@ files:
|
|
81
82
|
- sig/orthoses/content/header_builder.rbs
|
82
83
|
- sig/orthoses/create_file_by_name.rbs
|
83
84
|
- sig/orthoses/delegate_class.rbs
|
85
|
+
- sig/orthoses/delegate_class/hook.rbs
|
84
86
|
- sig/orthoses/filter.rbs
|
85
87
|
- sig/orthoses/load_rbs.rbs
|
86
88
|
- sig/orthoses/mixin.rbs
|
89
|
+
- sig/orthoses/mixin/hook.rbs
|
87
90
|
- sig/orthoses/name_space_error.rbs
|
88
91
|
- sig/orthoses/object_space_all.rbs
|
89
92
|
- sig/orthoses/pp.rbs
|