orthoses 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -3
  3. data/lib/orthoses/builder.rb +7 -3
  4. data/lib/orthoses/content/duplication_checker.rb +50 -35
  5. data/lib/orthoses/content/environment.rb +1 -1
  6. data/lib/orthoses/create_file_by_name.rb +38 -7
  7. data/lib/orthoses/missing_name.rb +81 -0
  8. data/lib/orthoses/mixin.rb +9 -4
  9. data/lib/orthoses/rbs_prototype_runtime.rb +21 -2
  10. data/lib/orthoses/utils.rb +1 -1
  11. data/lib/orthoses/version.rb +1 -1
  12. data/lib/orthoses.rb +1 -0
  13. data/sig/orthoses/_call.rbs +1 -1
  14. data/sig/orthoses/_middle_ware.rbs +1 -1
  15. data/sig/orthoses/attribute/hook.rbs +1 -1
  16. data/sig/orthoses/attribute.rbs +1 -1
  17. data/sig/orthoses/autoload/hook.rbs +1 -1
  18. data/sig/orthoses/autoload.rbs +1 -1
  19. data/sig/orthoses/builder/call_logable.rbs +1 -1
  20. data/sig/orthoses/builder.rbs +5 -4
  21. data/sig/orthoses/call_tracer/capturable.rbs +1 -1
  22. data/sig/orthoses/call_tracer/capture.rbs +2 -2
  23. data/sig/orthoses/call_tracer/lazy.rbs +2 -2
  24. data/sig/orthoses/call_tracer.rbs +1 -1
  25. data/sig/orthoses/const_load_error.rbs +1 -1
  26. data/sig/orthoses/constant.rbs +1 -1
  27. data/sig/orthoses/content/array_io.rbs +1 -1
  28. data/sig/orthoses/content/duplication_checker.rbs +5 -3
  29. data/sig/orthoses/content/environment.rbs +8 -3
  30. data/sig/orthoses/content/header_builder.rbs +1 -1
  31. data/sig/orthoses/content.rbs +2 -1
  32. data/sig/orthoses/create_file_by_name.rbs +2 -2
  33. data/sig/orthoses/delegate_class/hook.rbs +1 -1
  34. data/sig/orthoses/delegate_class.rbs +1 -1
  35. data/sig/orthoses/filter.rbs +1 -1
  36. data/sig/orthoses/lazy_trace_point.rbs +1 -1
  37. data/sig/orthoses/load_rbs.rbs +1 -1
  38. data/sig/orthoses/missing_name/missing_class.rbs +7 -0
  39. data/sig/orthoses/missing_name/missing_module.rbs +7 -0
  40. data/sig/orthoses/missing_name.rbs +6 -0
  41. data/sig/orthoses/mixin/hook.rbs +2 -2
  42. data/sig/orthoses/mixin.rbs +2 -2
  43. data/sig/orthoses/name_space_error.rbs +1 -1
  44. data/sig/orthoses/object_space_all.rbs +1 -1
  45. data/sig/orthoses/outputable/avoid_recursive_ancestor_error.rbs +1 -1
  46. data/sig/orthoses/outputable/constantizable_filter.rbs +1 -1
  47. data/sig/orthoses/outputable/uniq_content_body.rbs +1 -1
  48. data/sig/orthoses/outputable.rbs +1 -1
  49. data/sig/orthoses/path_helper.rbs +1 -1
  50. data/sig/orthoses/pp.rbs +1 -1
  51. data/sig/orthoses/rbs_prototype_rb.rbs +5 -3
  52. data/sig/orthoses/rbs_prototype_runtime.rbs +10 -3
  53. data/sig/orthoses/sort.rbs +1 -1
  54. data/sig/orthoses/store.rbs +1 -1
  55. data/sig/orthoses/tap.rbs +1 -1
  56. data/sig/orthoses/trace/attribute.rbs +1 -1
  57. data/sig/orthoses/trace/method/info.rbs +1 -1
  58. data/sig/orthoses/trace/method.rbs +1 -1
  59. data/sig/orthoses/trace/targetable.rbs +1 -1
  60. data/sig/orthoses/trace.rbs +1 -1
  61. data/sig/orthoses/utils/type_list.rbs +1 -1
  62. data/sig/orthoses/utils/underscore.rbs +1 -1
  63. data/sig/orthoses/utils.rbs +2 -2
  64. data/sig/orthoses/walk.rbs +1 -1
  65. data/sig/orthoses/writer.rbs +1 -1
  66. data/sig/orthoses.rbs +2 -2
  67. metadata +6 -21
  68. data/Gemfile +0 -16
  69. data/Gemfile.lock +0 -86
  70. data/examples/minitest/Rakefile +0 -56
  71. data/examples/rack-test/Gemfile +0 -8
  72. data/examples/rack-test/Gemfile.lock +0 -30
  73. data/examples/rack-test/Rakefile +0 -7
  74. data/examples/rack-test/generate.rb +0 -31
  75. data/examples/rack-test/out/rack/test/cookie.rbs +0 -28
  76. data/examples/rack-test/out/rack/test/cookie_jar.rbs +0 -28
  77. data/examples/rack-test/out/rack/test/fake_app.rbs +0 -13
  78. data/examples/rack-test/out/rack/test/input_rewinder.rbs +0 -8
  79. data/examples/rack-test/out/rack/test/methods.rbs +0 -98
  80. data/examples/rack-test/out/rack/test/session.rbs +0 -186
  81. data/examples/rack-test/out/rack/test/uploaded_file.rbs +0 -18
  82. data/examples/rack-test/out/rack/test/utils.rbs +0 -112
  83. data/examples/rack-test/out/rack/test.rbs +0 -3
  84. data/examples/simple_middleware.rb +0 -11
  85. data/examples/simple_middleware.rbs +0 -7
  86. data/orthoses.gemspec +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2915ad2b524676ac4ea67e61fcc90713bdaa8e79cb2ff01aeba74fe54b4885d
4
- data.tar.gz: 0f8823a7e88b4030eb6554ac9f35a068730ac944378832f923c99cf3b4e8e6be
3
+ metadata.gz: 0bbf41507135a45b3b2a45ffff90500a68a39f4497bf1fcbd72d94579fd27ae8
4
+ data.tar.gz: 8a6daa8a64d8bfbda565e24ec53622ca5530f5624e80f0c6fdfed5ca13b10786
5
5
  SHA512:
6
- metadata.gz: '06038e9dd28433a1c9358915720fe942f597caee2d68651ce7c54b47136633cc1d55288c7b8053766f393bacda9974b1ee662337f80d78b0796d405453b2cc32'
7
- data.tar.gz: 92074fd8665515453126f44627604f7fd3da1dcb7a85ec25b1ef51424c6797f9b1f67925d2349db05b7ce7aace06dc7f3f2d2be737cfb5399383bed4f846b11f
6
+ metadata.gz: c9d4a29dfc22972be165a703c4e86272a6e045ab34a91f76b560eeb329dca0795dab6eef59f419b50b7da4c390fcfa71d74d217baad3aa65b43f0000a2f7a126
7
+ data.tar.gz: 5579c33080fb673b50445fc8193f2876f8065e9ccc7ad2042020539a688f1242bfbe9dab265a780057040051f555f20b04ff62734ef844d25fea099a835d1c2a
data/README.md CHANGED
@@ -29,11 +29,13 @@ For example, You can write script in Rakefile.
29
29
  require 'orthoses'
30
30
 
31
31
  namespace :rbs do
32
- desc "build RBS to sig/out"
32
+ desc "build RBS to sig/orthoses"
33
33
  task :build do
34
34
  Orthoses::Builder.new do
35
35
  use Orthoses::CreateFileByName,
36
- base_dir: Rails.root.join("sig/out"),
36
+ depth: 1,
37
+ to: "sig/orthoses",
38
+ rmtree: true,
37
39
  header: "# !!! GENERATED CODE !!!"
38
40
  use Orthoses::Filter do |name, _content|
39
41
  path, _lineno = Object.const_source_location(name)
@@ -53,7 +55,7 @@ namespace :rbs do
53
55
  end
54
56
  ```
55
57
 
56
- Then, you can see the result files under `sig/out`.
58
+ Then, you can see the result files under `sig/orthoses`.
57
59
 
58
60
  ## Utils
59
61
 
@@ -177,6 +179,11 @@ Sort signatures by class/module.
177
179
 
178
180
  Trace the argument and return value objects when the method is actually called and determine the type.
179
181
 
182
+ ## Orthoses::MissingName
183
+
184
+ Completes undefined class/module names.
185
+ If it is unknown whether it is a class or a module, it is defined as an empty module, and if it is a superclass, it is defined as an empty class.
186
+
180
187
  ## Development
181
188
 
182
189
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -13,7 +13,7 @@ module Orthoses
13
13
  class Builder
14
14
  def initialize(&block)
15
15
  @use = []
16
- @run = nil
16
+ @runner = nil
17
17
  instance_eval(&block) if block
18
18
  end
19
19
 
@@ -37,7 +37,11 @@ module Orthoses
37
37
 
38
38
  def run(loader)
39
39
  use Store
40
- @run = proc do
40
+ reset_runner(loader)
41
+ end
42
+
43
+ def reset_runner(loader)
44
+ @runner = proc do
41
45
  Orthoses.logger.info("[loader].call start")
42
46
  loader.call.tap do
43
47
  Orthoses.logger.info("[loader].call end")
@@ -46,7 +50,7 @@ module Orthoses
46
50
  end
47
51
 
48
52
  def to_loader
49
- @use.reverse.inject(@run) { |current, next_proc| next_proc[current] }
53
+ @use.reverse.inject(@runner) { |current, next_proc| next_proc[current] }
50
54
  end
51
55
 
52
56
  def call
@@ -4,71 +4,86 @@ module Orthoses
4
4
  class DuplicationChecker
5
5
  def initialize(decl, env: nil)
6
6
  @decl = decl
7
- @env = env || Utils.rbs_environment
7
+ @known_env = env || Utils.rbs_environment
8
+ @builder = RBS::DefinitionBuilder.new(env: @known_env)
9
+ @uniq_map = {}
8
10
  end
9
11
 
10
12
  def update_decl
11
13
  return unless @decl.respond_to?(:members)
12
14
 
13
- uniq_map = uniq_members
14
- drop_set_method_definition(uniq_map)
15
- drop_known_method_definition(uniq_map)
15
+ uniq_members
16
+ drop_set_method_definition
17
+ drop_known_method_definition
18
+ drop_known_const_definition
16
19
 
17
- @decl.members.replace(uniq_map.values)
20
+ @decl.members.replace(@uniq_map.values)
21
+
22
+ @uniq_map.clear
18
23
  end
19
24
 
20
25
  private
21
26
 
22
27
  def uniq_members
23
- {}.tap do |uniq_map|
24
- @decl.members.each do |member|
25
- if member.instance_of?(RBS::AST::Members::MethodDefinition) && member.overloading?
26
- # avoid to duplicate and keep order
27
- uniq_map[Object.new] = member
28
- else
29
- key = member_key(member)
30
- drop_member = uniq_map[key]
31
- uniq_map[key] = member
32
- if drop_member
33
- Orthoses.logger.info("#{@decl.name} \"#{member.location.source}\" was droped since duplication")
34
- end
28
+ @decl.members.each do |member|
29
+ if member.instance_of?(RBS::AST::Members::MethodDefinition) && member.overloading?
30
+ # avoid to duplicate and keep order
31
+ @uniq_map[Object.new] = member
32
+ else
33
+ key = member_key(member)
34
+ drop_member = @uniq_map[key]
35
+ @uniq_map[key] = member
36
+ if drop_member
37
+ Orthoses.logger.info("#{@decl.name} \"#{member.location.source}\" was droped since duplication")
35
38
  end
36
39
  end
37
40
  end
38
41
  end
39
42
 
40
- def drop_set_method_definition(uniq_map)
41
- attr_accessors = uniq_map.values.grep(RBS::AST::Members::AttrAccessor)
43
+ def drop_set_method_definition
44
+ attr_accessors = @uniq_map.values.grep(RBS::AST::Members::AttrAccessor)
42
45
  attr_accessors.each do |member|
43
- uniq_map.delete([RBS::AST::Members::MethodDefinition, :"#{member.name}=", member.kind])
46
+ @uniq_map.delete([RBS::AST::Members::MethodDefinition, :"#{member.name}=", member.kind])
44
47
  end
45
48
  end
46
49
 
47
- def drop_known_method_definition(uniq_map)
50
+ def drop_known_method_definition
48
51
  decl_name = @decl.name.absolute!
49
- if m_entry = @env.class_decls[decl_name]
52
+ if m_entry = @known_env.class_decls[decl_name]
50
53
  m_entry.decls.each do |d|
51
- d.decl.members.each do |member|
52
- case member
53
- when RBS::AST::Members::LocationOnly
54
- # ignore
55
- when RBS::AST::Members::AttrAccessor
56
- uniq_map.delete([RBS::AST::Members::MethodDefinition, member.name, member.kind])
57
- uniq_map.delete([RBS::AST::Members::MethodDefinition, :"#{member.name}=", member.kind])
58
- else
59
- uniq_map.delete(member_key(member))
60
- end
54
+ drop_known_method_definition_recur(d)
55
+ end
56
+ end
57
+ end
58
+
59
+ def drop_known_method_definition_recur(d)
60
+ d.decl.members.each do |member|
61
+ case member
62
+ when RBS::AST::Members::LocationOnly
63
+ # ignore
64
+ when RBS::AST::Members::AttrAccessor
65
+ @uniq_map.delete([RBS::AST::Members::MethodDefinition, member.name, member.kind])
66
+ @uniq_map.delete([RBS::AST::Members::MethodDefinition, :"#{member.name}=", member.kind])
67
+ else
68
+ if member.kind_of?(RBS::AST::Members::Include) && member.name.interface?
69
+ # If interface is included, it is shared in the same namespace.
70
+ drop_known_method_definition_recur(@known_env.interface_decls[member.name])
71
+ else
72
+ @uniq_map.delete(member_key(member))
61
73
  end
62
74
  end
63
75
  end
76
+ end
64
77
 
65
- constants_in_uniq_map = uniq_map.select do |key, value|
78
+ def drop_known_const_definition
79
+ decl_name = @decl.name.absolute!
80
+ constants_in_uniq_map = @uniq_map.select do |key, value|
66
81
  value.kind_of?(RBS::AST::Declarations::Constant)
67
82
  end
68
83
  constants_in_uniq_map.each do |key, value|
69
84
  type_name = decl_name + value.name
70
- if @env.constant_decls[type_name]
71
- uniq_map.delete(key)
85
+ if @known_env.constant_decls[type_name]
86
+ @uniq_map.delete(key)
72
87
  end
73
88
  end
74
89
  end
@@ -42,7 +42,7 @@ module Orthoses
42
42
  def write_to(store:)
43
43
  each do |add_content|
44
44
  content = store[add_content.name]
45
- content.header ||= add_content.header
45
+ content.header = add_content.header
46
46
  content.comment ||= add_content.comment
47
47
  content.concat(add_content.body)
48
48
  end
@@ -6,31 +6,62 @@ module Orthoses
6
6
  class CreateFileByName
7
7
  prepend Outputable
8
8
 
9
- def initialize(loader, base_dir:, header: nil, if: nil)
9
+ def initialize(loader, base_dir: nil, to: nil, header: nil, if: nil, depth: nil, rmtree: false)
10
+ unless base_dir.nil?
11
+ warn "[Orthoses::CreateFileByName] base_dir: option is deprecated. Please use to: option instead."
12
+ end
13
+
14
+ to = to || base_dir
15
+ unless to
16
+ raise ArgumentError, "should set to: option"
17
+ end
18
+
19
+ relative_path_from_pwd = Pathname(to).expand_path.relative_path_from(Pathname.pwd).to_s
20
+ unless relative_path_from_pwd == "." || !relative_path_from_pwd.match?(%r{\A[/\.]})
21
+ raise ArgumentError, "to=\"#{to}\" should be under current dir=\"#{Pathname.pwd}\"."
22
+ end
23
+
10
24
  @loader = loader
11
- @base_dir = base_dir
25
+ @to = to
12
26
  @header = header
27
+ @depth = depth
28
+ @rmtree = rmtree
13
29
  @if = binding.local_variable_get(:if)
14
30
  end
15
31
 
16
32
  using Utils::Underscore
17
33
 
18
34
  def call
35
+ if @rmtree
36
+ Orthoses.logger.debug("Remove dir #{@to} since `rmtree: true`")
37
+ Pathname(@to).rmtree rescue nil
38
+ end
39
+
19
40
  store = @loader.call
20
41
 
21
- store.each do |name, content|
22
- next unless @if.nil? || @if.call(name, content)
42
+ store.select! do |name, content|
43
+ @if.nil? || @if.call(name, content)
44
+ end
45
+ grouped = store.group_by do |name, _|
46
+ splitted = name.to_s.split('::')
47
+ (@depth ? splitted[0, @depth] : splitted).join('::')
48
+ end
23
49
 
24
- file_path = Pathname("#{@base_dir}/#{name.to_s.split('::').map(&:underscore).join('/')}.rbs")
50
+ grouped.each do |group_name, group|
51
+ file_path = Pathname("#{@to}/#{group_name.split('::').map(&:underscore).join('/')}.rbs")
25
52
  file_path.dirname.mkpath
26
53
  file_path.open('w+') do |out|
27
54
  if @header
28
55
  out.puts @header
29
56
  out.puts
30
57
  end
31
- out.puts content.to_rbs
58
+ group.sort!
59
+ contents = group.map do |(name, content)|
60
+ content.to_rbs
61
+ end.join("\n")
62
+ out.puts contents
63
+ Orthoses.logger.info("Generate file to #{file_path.to_s}")
32
64
  end
33
- Orthoses.logger.info("Generate file to #{file_path.to_s}")
34
65
  end
35
66
  end
36
67
  end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orthoses
4
+ class MissingName
5
+ def initialize(loader)
6
+ @loader = loader
7
+ end
8
+
9
+ def call
10
+ @loader.call.tap do |store|
11
+ MissingClass.new(store).call
12
+ MissingModule.new(store).call
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ class MissingClass
19
+ def initialize(store)
20
+ @store = store
21
+ end
22
+
23
+ def call
24
+ @store.values.each do |content|
25
+ recur(content)
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def recur(content)
32
+ content.auto_header
33
+ if content.header && content.header.include?("<")
34
+ _, superclass = content.header.split(/\s*<\s*/, 2)
35
+ superclass.sub!(/\[.*/, "")
36
+ new_name = TypeName(superclass).relative!.to_s
37
+ recur(@store[new_name])
38
+ end
39
+ end
40
+ end
41
+
42
+ class MissingModule
43
+ def initialize(store)
44
+ @store = store
45
+ end
46
+
47
+ def call
48
+ missings = []
49
+ @store.keys.each do |key_name|
50
+ missings.concat split_name(key_name)
51
+ end
52
+ missings.uniq!
53
+ missings.each do |missing|
54
+ @store[missing].header = "module #{missing}"
55
+ end
56
+ end
57
+
58
+ private
59
+
60
+ def split_name(key_name)
61
+ ret = []
62
+
63
+ type_name = TypeName(key_name).relative!
64
+ if !Utils.rbs_defined_class?(type_name.to_s) && !@store.has_key?(type_name.to_s)
65
+ ret << type_name.to_s
66
+ end
67
+
68
+ path = type_name.namespace.path
69
+ path.each_with_index do |sym, index|
70
+ name = path[0, index + 1].join("::")
71
+ next if name.empty?
72
+ if !Utils.rbs_defined_class?(name) && !@store.has_key?(name)
73
+ ret << name
74
+ end
75
+ end
76
+
77
+ ret
78
+ end
79
+ end
80
+ end
81
+ end
@@ -50,6 +50,7 @@ module Orthoses
50
50
 
51
51
  base_mod_name = Utils.module_name(base_mod)
52
52
  next unless base_mod_name
53
+ next if base_mod_name.include?("#")
53
54
 
54
55
  content = store[base_mod_name]
55
56
  capture.argument[:modules].each do |mod|
@@ -58,13 +59,17 @@ module Orthoses
58
59
 
59
60
  next if mod_name.start_with?("Orthoses")
60
61
 
61
- known_type_params = Utils.known_type_params(mod)
62
- next unless known_type_params.nil? || known_type_params.empty?
62
+ type_params_sig = ""
63
+ if type_params = Utils.known_type_params(mod)
64
+ if !type_params.empty?
65
+ type_params_sig = "[#{type_params.map{"untyped"}.join(", ")}]"
66
+ end
67
+ end
63
68
 
64
69
  next unless @if.nil? || @if.call(base_mod, how, mod)
65
70
 
66
- store[mod_name]
67
- content << "#{how} #{mod_name}"
71
+ store[mod_name].header = "module #{mod_name}"
72
+ content << "#{how} #{mod_name}#{type_params_sig}"
68
73
  end
69
74
  end
70
75
  end
@@ -3,14 +3,33 @@ module Orthoses
3
3
  # use Orthoses::RBSPrototypeRuntime,
4
4
  # patterns: ['Foo::*']
5
5
  class RBSPrototypeRuntime
6
- def initialize(loader, patterns:)
6
+ def initialize(
7
+ loader,
8
+ patterns:,
9
+ method_definition_filter: nil,
10
+ alias_filter: nil,
11
+ constant_filter: nil,
12
+ mixin_filter: nil,
13
+ attribute_filter: nil
14
+ )
7
15
  @loader = loader
8
16
  @patterns = patterns
17
+ @method_definition_filter = method_definition_filter
18
+ @alias_filter = alias_filter
19
+ @constant_filter = constant_filter
20
+ @mixin_filter = mixin_filter
21
+ @attribute_filter = attribute_filter
9
22
  end
10
23
 
11
24
  def call
12
25
  @loader.call.tap do |store|
13
- content_env = Orthoses::Content::Environment.new
26
+ content_env = Orthoses::Content::Environment.new(
27
+ method_definition_filter: @method_definition_filter,
28
+ alias_filter: @alias_filter,
29
+ constant_filter: @constant_filter,
30
+ mixin_filter: @mixin_filter,
31
+ attribute_filter: @attribute_filter,
32
+ )
14
33
 
15
34
  patterns = @patterns
16
35
  env = RBS::Environment.new
@@ -177,7 +177,7 @@ module Orthoses
177
177
  when String
178
178
  TypeName(name).absolute!
179
179
  when Module
180
- module_to_type_name(name)
180
+ module_to_type_name(name).absolute!
181
181
  else
182
182
  raise TypeError
183
183
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orthoses
4
- VERSION = "1.7.0"
4
+ VERSION = "1.8.0"
5
5
  end
data/lib/orthoses.rb CHANGED
@@ -17,6 +17,7 @@ module Orthoses
17
17
  autoload :Mixin, 'orthoses/mixin'
18
18
  autoload :LazyTracePoint, 'orthoses/lazy_trace_point'
19
19
  autoload :LoadRBS, 'orthoses/load_rbs'
20
+ autoload :MissingName, 'orthoses/missing_name'
20
21
  autoload :ObjectSpaceAll, 'orthoses/object_space_all'
21
22
  autoload :Outputable, 'orthoses/outputable'
22
23
  autoload :PathHelper, 'orthoses/path_helper'
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  interface Orthoses::_Call
4
4
  def call: () -> Orthoses::store
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  interface Orthoses::_MiddleWare
4
4
  include Orthoses::_Call
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  module Orthoses::Attribute::Hook
4
4
  def attr: (*untyped names) -> untyped
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  class Orthoses::Attribute
4
4
  def initialize: (Orthoses::_Call loader) -> void
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  module Orthoses::Autoload::Hook
4
4
  def autoload: (untyped name, untyped path) -> untyped
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  class Orthoses::Autoload
4
4
  def initialize: (untyped loader) -> void
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  module Orthoses::Builder::CallLogable
4
4
  def call: () -> untyped
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  # Middleware builder like the Rack
4
4
  # Builder.new do
@@ -10,9 +10,10 @@
10
10
  # run ->() { require 'foo' }
11
11
  # end
12
12
  class Orthoses::Builder
13
- def initialize: () ?{ () -> untyped } -> void
14
- def use: (untyped middleware, *untyped args, **untyped key) ?{ () -> untyped } -> untyped
13
+ def initialize: () ?{ () [self: Orthoses::Builder] -> untyped } -> void
14
+ def use: (untyped middleware, *untyped args, **untyped key) ?{ (*untyped, **untyped) -> untyped } -> untyped
15
15
  def run: (untyped loader) -> untyped
16
+ def reset_runner: (untyped loader) -> untyped
16
17
  def to_loader: () -> untyped
17
- def call: () { () -> void } -> Orthoses::store
18
+ def call: () -> Orthoses::store
18
19
  end
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  module Orthoses::CallTracer::Capturable
4
4
  def build_capture: (untyped tp) -> untyped
@@ -1,6 +1,6 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
- class Orthoses::CallTracer::Capture
3
+ class Orthoses::CallTracer::Capture < ::Struct[untyped]
4
4
  def method: () -> Method
5
5
  def argument: () -> Hash[Symbol, untyped]
6
6
  end
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  # CallTracer::Lazy is possible to perform a trace
4
4
  # equivalent to CallTracer before method is defined.
@@ -15,5 +15,5 @@
15
15
  class Orthoses::CallTracer::Lazy
16
16
  def initialize: () -> void
17
17
  def trace: (String name) ?{ () -> untyped } -> untyped
18
- attr_reader captures: Array[untyped]
18
+ attr_reader captures: Array[Orthoses::CallTracer::Capture]
19
19
  end
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  class Orthoses::CallTracer
4
4
  def initialize: () -> void
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  class Orthoses::ConstLoadError < ::StandardError
4
4
  def initialize: (root: Module, const: Symbol, error: untyped) -> void
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  class Orthoses::Constant
4
4
  def initialize: (Orthoses::_Call loader, ?strict: bool, ?if: ^(Module, Symbol, untyped) -> boolish | nil, ?on_error: ^(Orthoses::ConstLoadError) -> void | nil) -> void
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  class Orthoses::Content::ArrayIO
4
4
  def initialize: () -> void
@@ -1,11 +1,13 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  # Check and drop duplication method, const etc...
4
4
  class Orthoses::Content::DuplicationChecker
5
5
  def initialize: (untyped decl, ?env: untyped?) -> void
6
6
  def update_decl: () -> (nil | untyped)
7
7
  private def uniq_members: () -> untyped
8
- private def drop_set_method_definition: (untyped uniq_map) -> untyped
9
- private def drop_known_method_definition: (untyped uniq_map) -> untyped
8
+ private def drop_set_method_definition: () -> untyped
9
+ private def drop_known_method_definition: () -> untyped
10
+ private def drop_known_method_definition_recur: (untyped d) -> untyped
11
+ private def drop_known_const_definition: () -> untyped
10
12
  private def member_key: (untyped member) -> untyped
11
13
  end
@@ -1,8 +1,8 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  class Orthoses::Content::Environment
4
4
  def self.load_from_paths: (untyped paths) -> untyped
5
- def initialize: (?constant_filter: constant_filter?, ?mixin_filter: mixin_filter?, ?attribute_filter: attribute_filter?) -> void
5
+ def initialize: (?method_definition_filter: method_definition_filter?, ?alias_filter: alias_filter?, ?constant_filter: constant_filter?, ?mixin_filter: mixin_filter?, ?attribute_filter: attribute_filter?) -> void
6
6
  def <<: (RBS::AST::Declarations::t decl) -> RBS::Environment
7
7
  def write_to: (store: Orthoses::store) -> void
8
8
  def each: () { (Orthoses::Content) -> void } -> void
@@ -11,10 +11,15 @@ class Orthoses::Content::Environment
11
11
  # end
12
12
  private def avoid_generic_parameter_mismatch_error: () -> untyped
13
13
  private def decls_to_lines: (untyped decls) -> untyped
14
+ type method_definition_filter = ^(RBS::AST::Members::MethodDefinition) -> boolish
15
+ type alias_filter = ^(RBS::AST::Members::Alias) -> boolish
14
16
  type constant_filter = ^(RBS::AST::Declarations::Constant) -> boolish
15
17
  type mixin_filter = ^(RBS::AST::Members::Mixin) -> boolish
16
18
  type attribute_filter = ^(RBS::AST::Members::Attribute) -> boolish
17
- @env: RBS::Environment
19
+ @load_env: RBS::Environment
20
+ @known_env: RBS::Environment
21
+ @method_definition_filter: method_definition_filter?
22
+ @alias_filter: alias_filter?
18
23
  @constant_filter: constant_filter?
19
24
  @mixin_filter: mixin_filter?
20
25
  @attribute_filter: attribute_filter?
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  class Orthoses::Content::HeaderBuilder
4
4
  def initialize: (env: untyped) -> void
@@ -1,4 +1,4 @@
1
- # THIS IS GENERATED CODE from `$ rake generate_self_sig`
1
+ # THIS IS GENERATED CODE from `$ rake sig`
2
2
 
3
3
  class Orthoses::Content
4
4
  def initialize: (name: String) -> void
@@ -21,4 +21,5 @@ class Orthoses::Content
21
21
  attr_reader name: String
22
22
  attr_reader body: Array[String]
23
23
  attr_accessor header: String?
24
+ attr_accessor comment: String?
24
25
  end