orthoses 0.3.0 → 0.6.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 +3 -3
- data/README.md +16 -12
- data/examples/minitest/Rakefile +56 -0
- data/examples/simple_middleware.rb +11 -0
- data/examples/simple_middleware.rbs +7 -0
- data/lib/orthoses/attribute.rb +98 -0
- data/lib/orthoses/avoid_recursive_ancestor_error.rb +22 -0
- data/lib/orthoses/builder.rb +1 -0
- data/lib/orthoses/content/duplication_checker.rb +30 -12
- data/lib/orthoses/content/environment.rb +44 -47
- data/lib/orthoses/content/header_builder.rb +94 -0
- data/lib/orthoses/content.rb +50 -29
- data/lib/orthoses/load_rbs.rb +1 -8
- data/lib/orthoses/mixin.rb +1 -9
- data/lib/orthoses/rbs_prototype_rb.rb +4 -1
- data/lib/orthoses/utils.rb +33 -7
- data/lib/orthoses/version.rb +1 -1
- data/lib/orthoses.rb +2 -0
- data/sig/orthoses/_call.rbs +1 -1
- data/sig/orthoses/attribute/hook.rbs +11 -0
- data/sig/orthoses/attribute.rbs +9 -0
- data/sig/orthoses/avoid_recursive_ancestor_error.rbs +7 -0
- data/sig/orthoses/builder/call_logable.rbs +1 -0
- data/sig/orthoses/builder.rbs +5 -0
- data/sig/orthoses/call_tracer.rbs +2 -0
- data/sig/orthoses/const_load_error.rbs +1 -0
- data/sig/orthoses/constant.rbs +5 -2
- data/sig/orthoses/content/duplication_checker.rbs +6 -0
- data/sig/orthoses/content/environment.rbs +14 -4
- data/sig/orthoses/content/header_builder.rbs +13 -0
- data/sig/orthoses/content.rbs +10 -0
- data/sig/orthoses/create_file_by_name.rbs +2 -2
- 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.rbs +2 -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 +6 -4
- data/sig/orthoses/walk.rbs +2 -2
- data/sig/orthoses/writer.rbs +2 -2
- data/sig/orthoses.rbs +1 -1
- metadata +12 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3fe5907a7edff87d73372b0e6f556d5f3b08a3ae6d7407447f249a25953d069e
         | 
| 4 | 
            +
              data.tar.gz: 7564345ffdc6363a5ba03bb9c70299b17cb15cdb3cc501bcbd3b221c7b0a823a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 35acabbfbd4ab4c549d8cefdecc829074ade2bc041093432b3a1ae52c095f1d2e8a4420d30754dfd0a1dfb9d09f999fb2885b4f87c7e14c2c3386afff886082f
         | 
| 7 | 
            +
              data.tar.gz: 01f8881d042a106e720574902abc2227161c65c78b35277618aea2343f8be43dfdcb4d94735ce2f5a7fd62ffb5137e5c928e0bd1e9dd50cd583ecd6819c80d38
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                orthoses (0. | 
| 4 | 
            +
                orthoses (0.6.0)
         | 
| 5 5 | 
             
                  rbs (~> 2.0)
         | 
| 6 6 |  | 
| 7 7 | 
             
            GEM
         | 
| @@ -30,9 +30,9 @@ GEM | |
| 30 30 | 
             
                rb-fsevent (0.11.1)
         | 
| 31 31 | 
             
                rb-inotify (0.10.1)
         | 
| 32 32 | 
             
                  ffi (~> 1.0)
         | 
| 33 | 
            -
                rbs (2. | 
| 33 | 
            +
                rbs (2.5.0)
         | 
| 34 34 | 
             
                rgot (1.1.0)
         | 
| 35 | 
            -
                steep (0. | 
| 35 | 
            +
                steep (1.0.0)
         | 
| 36 36 | 
             
                  activesupport (>= 5.1)
         | 
| 37 37 | 
             
                  language_server-protocol (>= 3.15, < 4.0)
         | 
| 38 38 | 
             
                  listen (~> 3.0)
         | 
    
        data/README.md
    CHANGED
    
    | @@ -89,18 +89,6 @@ This is very useful for middleware development and debugging. | |
| 89 89 | 
             
            If a class is defined using the `DelegateClass` method
         | 
| 90 90 | 
             
            RBS is automatically generated as inherited.
         | 
| 91 91 |  | 
| 92 | 
            -
            ### Orthoses::Writer
         | 
| 93 | 
            -
             | 
| 94 | 
            -
            Write output RBS to `io` option object.
         | 
| 95 | 
            -
            `io` should be able to call `#write` method.
         | 
| 96 | 
            -
            This is useful when you want to combine outputs into a single output.
         | 
| 97 | 
            -
             | 
| 98 | 
            -
            ### Orthoses::RBSPrototypeRB
         | 
| 99 | 
            -
             | 
| 100 | 
            -
            Run `rbs prototype rb` command process to `paths` option files.
         | 
| 101 | 
            -
            `content_filter` option could filter with content decl.
         | 
| 102 | 
            -
            `mixin_filter` option could filter with mixin(include, extend, prepend) decl.
         | 
| 103 | 
            -
             | 
| 104 92 | 
             
            .rb
         | 
| 105 93 |  | 
| 106 94 | 
             
            ```rb
         | 
| @@ -115,6 +103,22 @@ class Tempfile < File | |
| 115 103 | 
             
            end
         | 
| 116 104 | 
             
            ```
         | 
| 117 105 |  | 
| 106 | 
            +
            ### Orthoses::Writer
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            Write output RBS to `io` option object.
         | 
| 109 | 
            +
            `io` should be able to call `#write` method.
         | 
| 110 | 
            +
            This is useful when you want to combine outputs into a single output.
         | 
| 111 | 
            +
             | 
| 112 | 
            +
            ### Orthoses::RBSPrototypeRB
         | 
| 113 | 
            +
             | 
| 114 | 
            +
            Run `rbs prototype rb` command process to `paths` option files.
         | 
| 115 | 
            +
            `content_filter` option could filter with content decl.
         | 
| 116 | 
            +
            `mixin_filter` option could filter with mixin(include, extend, prepend) decl.
         | 
| 117 | 
            +
             | 
| 118 | 
            +
            ### Orthoses::AvoidRecursiveAncestorError
         | 
| 119 | 
            +
             | 
| 120 | 
            +
            Mixin a module into an Object class raises `RBS::RecursiveAncestorError` when validation.
         | 
| 121 | 
            +
            Please add this middleware then.
         | 
| 118 122 |  | 
| 119 123 | 
             
            ## Development
         | 
| 120 124 |  | 
| @@ -0,0 +1,56 @@ | |
| 1 | 
            +
            file :src do
         | 
| 2 | 
            +
              sh "git clone https://github.com/minitest/minitest.git src"
         | 
| 3 | 
            +
            end
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            desc "generate minitest"
         | 
| 6 | 
            +
            task :minitest => :src do
         | 
| 7 | 
            +
              $:.unshift(File.expand_path("src/lib"))
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              out = Pathname('out')
         | 
| 10 | 
            +
              out.rmtree rescue nil
         | 
| 11 | 
            +
              require 'orthoses'
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              Orthoses::Builder.new do
         | 
| 14 | 
            +
                use Orthoses::CreateFileByName,
         | 
| 15 | 
            +
                  base_dir: out.to_s
         | 
| 16 | 
            +
                use Orthoses::Filter, if: ->(name, content) {
         | 
| 17 | 
            +
                  name.start_with?("Minitest") || name == "Kernel"
         | 
| 18 | 
            +
                }
         | 
| 19 | 
            +
                use Orthoses::Constant,
         | 
| 20 | 
            +
                  strict: false,
         | 
| 21 | 
            +
                  if: ->(current, const, val, rbs){
         | 
| 22 | 
            +
                    !Orthoses::Utils.rbs_defined_const?("#{current}::#{const}")
         | 
| 23 | 
            +
                  }
         | 
| 24 | 
            +
                use Orthoses::Mixin
         | 
| 25 | 
            +
                use Orthoses::Attribute
         | 
| 26 | 
            +
                use Orthoses::RBSPrototypeRB,
         | 
| 27 | 
            +
                  paths: Dir.glob('src/lib/minitest{.rb,/*.rb}'),
         | 
| 28 | 
            +
                  constant_filter: ->(_) { false },
         | 
| 29 | 
            +
                  mixin_filter: ->(_) { false },
         | 
| 30 | 
            +
                  attribute_filter: ->(_) { false }
         | 
| 31 | 
            +
                run ->(){
         | 
| 32 | 
            +
                  require_relative 'src/lib/minitest'
         | 
| 33 | 
            +
                  require_relative 'src/lib/minitest/test'
         | 
| 34 | 
            +
                  require_relative 'src/lib/minitest/spec'
         | 
| 35 | 
            +
                  require_relative 'src/lib/minitest/parallel'
         | 
| 36 | 
            +
                  require_relative 'src/lib/minitest/mock'
         | 
| 37 | 
            +
                  require_relative 'src/lib/minitest/benchmark'
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                  require_relative 'src/lib/minitest/pride_plugin'
         | 
| 40 | 
            +
                }
         | 
| 41 | 
            +
              end.call
         | 
| 42 | 
            +
             | 
| 43 | 
            +
              sh "rbs -r mutex_m -I #{out} validate --silent"
         | 
| 44 | 
            +
              out.join("manifest.yaml").write <<~YAML
         | 
| 45 | 
            +
                dependencies:
         | 
| 46 | 
            +
                  - name: mutex_m
         | 
| 47 | 
            +
              YAML
         | 
| 48 | 
            +
              tmp = out.join("kernel.rbs").read
         | 
| 49 | 
            +
              out.join("kernel.rbs").open("w") do |f|
         | 
| 50 | 
            +
                f.puts "%a{annotate:rdoc:skip}"
         | 
| 51 | 
            +
                f.write tmp
         | 
| 52 | 
            +
              end
         | 
| 53 | 
            +
              sh "rbs annotate --gems out"
         | 
| 54 | 
            +
            end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            task default: :minitest
         | 
| @@ -0,0 +1,98 @@ | |
| 1 | 
            +
            module Orthoses
         | 
| 2 | 
            +
              class Attribute
         | 
| 3 | 
            +
                module Hook
         | 
| 4 | 
            +
                  def attr(*names)
         | 
| 5 | 
            +
                    super
         | 
| 6 | 
            +
                  end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  def attr_accessor(*names)
         | 
| 9 | 
            +
                    super
         | 
| 10 | 
            +
                  end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  def attr_reader(*names)
         | 
| 13 | 
            +
                    super
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                  def attr_writer(*names)
         | 
| 17 | 
            +
                    super
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                def initialize(loader)
         | 
| 22 | 
            +
                  @loader = loader
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                def call
         | 
| 26 | 
            +
                  Module.prepend(Hook)
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  attr = CallTracer.new
         | 
| 29 | 
            +
                  attr_accessor = CallTracer.new
         | 
| 30 | 
            +
                  attr_reader = CallTracer.new
         | 
| 31 | 
            +
                  attr_writer = CallTracer.new
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  store = attr.trace(Hook.method(:attr)) do
         | 
| 34 | 
            +
                    attr_accessor.trace(Hook.method(:attr_accessor)) do
         | 
| 35 | 
            +
                      attr_reader.trace(Hook.method(:attr_reader)) do
         | 
| 36 | 
            +
                        attr_writer.trace(Hook.method(:attr_writer)) do
         | 
| 37 | 
            +
                          @loader.call
         | 
| 38 | 
            +
                        end
         | 
| 39 | 
            +
                      end
         | 
| 40 | 
            +
                    end
         | 
| 41 | 
            +
                  end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                  store["Module"].body.delete("prepend Orthoses::Attribute::Hook")
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                  attr.result.each do |method, argument|
         | 
| 46 | 
            +
                    m = method.receiver.to_s.match(/#<Class:([\w:]+)>/)
         | 
| 47 | 
            +
                    if m && m[1]
         | 
| 48 | 
            +
                      receiver_name = m[1]
         | 
| 49 | 
            +
                      prefix = "self."
         | 
| 50 | 
            +
                    else
         | 
| 51 | 
            +
                      receiver_name = Utils.module_name(method.receiver) or next
         | 
| 52 | 
            +
                      prefix = nil
         | 
| 53 | 
            +
                    end
         | 
| 54 | 
            +
                    content = store[receiver_name]
         | 
| 55 | 
            +
                    if argument[:names][1].equal?(true)
         | 
| 56 | 
            +
                      content << "attr_accessor #{prefix}#{argument[:names][0]}: untyped"
         | 
| 57 | 
            +
                    elsif argument[:names][1].equal?(false)
         | 
| 58 | 
            +
                      content << "attr_reader #{prefix}#{argument[:names][0]}: untyped"
         | 
| 59 | 
            +
                    else
         | 
| 60 | 
            +
                      argument[:names].each do |name|
         | 
| 61 | 
            +
                        content << "attr_reader #{prefix}#{name}: untyped"
         | 
| 62 | 
            +
                      end
         | 
| 63 | 
            +
                    end
         | 
| 64 | 
            +
                  end
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                  each_definition(attr_accessor) do |receiver_name, name|
         | 
| 67 | 
            +
                    store[receiver_name] << "attr_accessor #{name}: untyped"
         | 
| 68 | 
            +
                  end
         | 
| 69 | 
            +
                  each_definition(attr_reader) do |receiver_name, name|
         | 
| 70 | 
            +
                    store[receiver_name] << "attr_reader #{name}: untyped"
         | 
| 71 | 
            +
                  end
         | 
| 72 | 
            +
                  each_definition(attr_writer) do |receiver_name, name|
         | 
| 73 | 
            +
                    store[receiver_name] << "attr_writer #{name}: untyped"
         | 
| 74 | 
            +
                  end
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                  store
         | 
| 77 | 
            +
                end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                private
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                def each_definition(call_tracer)
         | 
| 82 | 
            +
                  call_tracer.result.each do |method, argument|
         | 
| 83 | 
            +
                    m = method.receiver.to_s.match(/#<Class:([\w:]+)>/)
         | 
| 84 | 
            +
                    if m && m[1]
         | 
| 85 | 
            +
                      receiver_name = m[1]
         | 
| 86 | 
            +
                      argument[:names].each do |name|
         | 
| 87 | 
            +
                        yield [receiver_name, "self.#{name}"]
         | 
| 88 | 
            +
                      end
         | 
| 89 | 
            +
                    else
         | 
| 90 | 
            +
                      receiver_name = Utils.module_name(method.receiver) or next
         | 
| 91 | 
            +
                      argument[:names].each do |name|
         | 
| 92 | 
            +
                        yield [receiver_name, name]
         | 
| 93 | 
            +
                      end
         | 
| 94 | 
            +
                    end
         | 
| 95 | 
            +
                  end
         | 
| 96 | 
            +
                end
         | 
| 97 | 
            +
              end
         | 
| 98 | 
            +
            end
         | 
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            module Orthoses
         | 
| 2 | 
            +
              class AvoidRecursiveAncestorError
         | 
| 3 | 
            +
                def initialize(loader)
         | 
| 4 | 
            +
                  @loader = loader
         | 
| 5 | 
            +
                end
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def call
         | 
| 8 | 
            +
                  @loader.call.tap do |store|
         | 
| 9 | 
            +
                    object_mixins = {}
         | 
| 10 | 
            +
                    store["Object"].to_decl.members.each do |member|
         | 
| 11 | 
            +
                      case member
         | 
| 12 | 
            +
                      when RBS::AST::Members::Mixin
         | 
| 13 | 
            +
                        object_mixins[member.name.relative!.to_s] = true
         | 
| 14 | 
            +
                      end
         | 
| 15 | 
            +
                    end
         | 
| 16 | 
            +
                    object_mixins.each_key do |object_mixin|
         | 
| 17 | 
            +
                      store[object_mixin].header = "module #{object_mixin} : BasicObject"
         | 
| 18 | 
            +
                    end
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
            end
         | 
    
        data/lib/orthoses/builder.rb
    CHANGED
    
    
| @@ -4,24 +4,35 @@ module Orthoses | |
| 4 4 | 
             
                class DuplicationChecker
         | 
| 5 5 | 
             
                  def initialize(decl)
         | 
| 6 6 | 
             
                    @decl = decl
         | 
| 7 | 
            -
                    @uniq_map = {}
         | 
| 8 7 | 
             
                  end
         | 
| 9 8 |  | 
| 10 | 
            -
                  def  | 
| 11 | 
            -
                     | 
| 12 | 
            -
                     | 
| 13 | 
            -
                       | 
| 14 | 
            -
             | 
| 15 | 
            -
                       | 
| 9 | 
            +
                  def update_decl
         | 
| 10 | 
            +
                    uniq_map = {}
         | 
| 11 | 
            +
                    @decl.members.each do |member|
         | 
| 12 | 
            +
                      key = member_key(member)
         | 
| 13 | 
            +
                      drop_member = uniq_map[key]
         | 
| 14 | 
            +
                      uniq_map[key] = member
         | 
| 15 | 
            +
                      if drop_member
         | 
| 16 | 
            +
                        Orthoses.logger.warn("#{@decl.name}::#{drop_member} was droped since duplication")
         | 
| 17 | 
            +
                      end
         | 
| 16 18 | 
             
                    end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
                  def uniq_members
         | 
| 20 | 
            -
                    @uniq_map.values
         | 
| 19 | 
            +
                    drop_known_method_definition(uniq_map)
         | 
| 20 | 
            +
                    @decl.members.replace(uniq_map.values)
         | 
| 21 21 | 
             
                  end
         | 
| 22 22 |  | 
| 23 23 | 
             
                  private
         | 
| 24 24 |  | 
| 25 | 
            +
                  def drop_known_method_definition(uniq_map)
         | 
| 26 | 
            +
                    env = Utils.rbs_environment(collection: true)
         | 
| 27 | 
            +
                    if m_entry = env.class_decls[@decl.name.absolute!]
         | 
| 28 | 
            +
                      m_entry.decls.each do |d|
         | 
| 29 | 
            +
                        d.decl.members.grep_v(RBS::AST::Members::LocationOnly).each do |member|
         | 
| 30 | 
            +
                          uniq_map.delete(member_key(member))
         | 
| 31 | 
            +
                        end
         | 
| 32 | 
            +
                      end
         | 
| 33 | 
            +
                    end
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
             | 
| 25 36 | 
             
                  def member_to_s(member)
         | 
| 26 37 | 
             
                    out = StringIO.new
         | 
| 27 38 | 
             
                    RBS::Writer.new(out: out).write_member(member)
         | 
| @@ -36,7 +47,14 @@ module Orthoses | |
| 36 47 | 
             
                    when RBS::AST::Members::LocationOnly
         | 
| 37 48 | 
             
                      [member.class]
         | 
| 38 49 | 
             
                    when RBS::AST::Members::Alias
         | 
| 39 | 
            -
                      [ | 
| 50 | 
            +
                      [RBS::AST::Members::MethodDefinition, member.new_name, member.kind]
         | 
| 51 | 
            +
                    when RBS::AST::Members::AttrAccessor
         | 
| 52 | 
            +
                      # FIXME: how to check "#{member.name}=" ?
         | 
| 53 | 
            +
                      [RBS::AST::Members::MethodDefinition, member.name, member.kind]
         | 
| 54 | 
            +
                    when RBS::AST::Members::AttrReader
         | 
| 55 | 
            +
                      [RBS::AST::Members::MethodDefinition, member.name, member.kind]
         | 
| 56 | 
            +
                    when RBS::AST::Members::AttrWriter
         | 
| 57 | 
            +
                      [RBS::AST::Members::MethodDefinition, "#{member.name}=", member.kind]
         | 
| 40 58 | 
             
                    else
         | 
| 41 59 | 
             
                      [member.class, member.name]
         | 
| 42 60 | 
             
                    end
         | 
| @@ -1,87 +1,82 @@ | |
| 1 1 | 
             
            module Orthoses
         | 
| 2 2 | 
             
              class Content
         | 
| 3 3 | 
             
                class Environment
         | 
| 4 | 
            -
                   | 
| 5 | 
            -
                     | 
| 4 | 
            +
                  class << self
         | 
| 5 | 
            +
                    def load_from_paths(paths)
         | 
| 6 | 
            +
                      new.tap do |env|
         | 
| 7 | 
            +
                        paths.each do |path|
         | 
| 8 | 
            +
                          Orthoses.logger.debug("Load #{path}")
         | 
| 9 | 
            +
                          buffer = RBS::Buffer.new(name: path.to_s, content: File.read(path.to_s, encoding: "UTF-8"))
         | 
| 10 | 
            +
                          RBS::Parser.parse_signature(buffer).each do |decl|
         | 
| 11 | 
            +
                            env << decl
         | 
| 12 | 
            +
                          end
         | 
| 13 | 
            +
                        end
         | 
| 14 | 
            +
                      end
         | 
| 15 | 
            +
                    end
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  def initialize(constant_filter: nil, mixin_filter: nil, attribute_filter: nil)
         | 
| 19 | 
            +
                    @load_env = RBS::Environment.new
         | 
| 20 | 
            +
                    @known_env = Utils.rbs_environment(collection: true, cache: false)
         | 
| 6 21 | 
             
                    @constant_filter = constant_filter
         | 
| 7 22 | 
             
                    @mixin_filter = mixin_filter
         | 
| 23 | 
            +
                    @attribute_filter = attribute_filter
         | 
| 8 24 | 
             
                  end
         | 
| 9 25 |  | 
| 10 26 | 
             
                  def <<(decl)
         | 
| 11 | 
            -
                    @ | 
| 27 | 
            +
                    @load_env << decl
         | 
| 28 | 
            +
                    @known_env << decl
         | 
| 29 | 
            +
                  rescue RBS::DuplicatedDeclarationError => err
         | 
| 30 | 
            +
                    Orthoses.logger.warn(err.inspect)
         | 
| 12 31 | 
             
                  end
         | 
| 13 32 |  | 
| 14 33 | 
             
                  def write_to(store:)
         | 
| 15 34 | 
             
                    each do |add_content|
         | 
| 16 35 | 
             
                      content = store[add_content.name]
         | 
| 17 | 
            -
                       | 
| 36 | 
            +
                      content.header = add_content.header
         | 
| 18 37 | 
             
                      content.concat(add_content.body)
         | 
| 19 38 | 
             
                    end
         | 
| 20 39 | 
             
                  end
         | 
| 21 40 |  | 
| 22 41 | 
             
                  def each
         | 
| 23 | 
            -
                     | 
| 24 | 
            -
                      yield content
         | 
| 25 | 
            -
                    end
         | 
| 26 | 
            -
                    each_interface do |content|
         | 
| 27 | 
            -
                      yield content
         | 
| 28 | 
            -
                    end
         | 
| 29 | 
            -
                  end
         | 
| 42 | 
            +
                    avoid_generic_parameter_mismatch_error
         | 
| 30 43 |  | 
| 31 | 
            -
             | 
| 44 | 
            +
                    header_builder = HeaderBuilder.new(env: @known_env)
         | 
| 32 45 |  | 
| 33 | 
            -
             | 
| 34 | 
            -
                    @env.class_decls.each do |type_name, m_entry|
         | 
| 46 | 
            +
                    @load_env.class_decls.each do |type_name, m_entry|
         | 
| 35 47 | 
             
                      name = type_name.relative!.to_s
         | 
| 36 48 | 
             
                      content = Content.new(name: name)
         | 
| 37 | 
            -
                       | 
| 38 | 
            -
                      when RBS::AST::Declarations::Module
         | 
| 39 | 
            -
                        self_types = decl.self_types.empty? ? nil : " : #{decl.self_types.join(', ')}"
         | 
| 40 | 
            -
                        content.header = "module #{name_and_params(name, decl.type_params)}#{self_types}"
         | 
| 41 | 
            -
                      when RBS::AST::Declarations::Class
         | 
| 42 | 
            -
                        super_class = decl.super_class.nil? ? nil : " < #{name_and_args(decl.super_class.name, decl.super_class.args)}"
         | 
| 43 | 
            -
                        content.header = "class #{name_and_params(name, decl.type_params)}#{super_class}"
         | 
| 44 | 
            -
                      else
         | 
| 45 | 
            -
                        raise
         | 
| 46 | 
            -
                      end
         | 
| 49 | 
            +
                      content.header = header_builder.build(entry: m_entry, name_hint: name)
         | 
| 47 50 | 
             
                      decls_to_lines(m_entry.decls.map(&:decl)).each do |line|
         | 
| 48 51 | 
             
                        content << line
         | 
| 49 52 | 
             
                      end
         | 
| 50 53 | 
             
                      yield content
         | 
| 51 54 | 
             
                    end
         | 
| 52 | 
            -
                  end
         | 
| 53 55 |  | 
| 54 | 
            -
             | 
| 55 | 
            -
                    @env.interface_decls.each do |type_name, s_entry|
         | 
| 56 | 
            +
                    @load_env.interface_decls.each do |type_name, s_entry|
         | 
| 56 57 | 
             
                      name = type_name.relative!.to_s
         | 
| 57 58 | 
             
                      content = Content.new(name: name)
         | 
| 58 | 
            -
                       | 
| 59 | 
            -
                       | 
| 60 | 
            -
                      decls_to_lines([decl]).each do |line|
         | 
| 59 | 
            +
                      content.header = header_builder.build(entry: s_entry)
         | 
| 60 | 
            +
                      decls_to_lines([s_entry.decl]).each do |line|
         | 
| 61 61 | 
             
                        content << line
         | 
| 62 62 | 
             
                      end
         | 
| 63 63 | 
             
                      yield content
         | 
| 64 64 | 
             
                    end
         | 
| 65 65 | 
             
                  end
         | 
| 66 66 |  | 
| 67 | 
            -
                   | 
| 68 | 
            -
                    if params.empty?
         | 
| 69 | 
            -
                      "#{name}"
         | 
| 70 | 
            -
                    else
         | 
| 71 | 
            -
                      ps = params.each.map do |param|
         | 
| 72 | 
            -
                        param.to_s
         | 
| 73 | 
            -
                      end
         | 
| 74 | 
            -
             | 
| 75 | 
            -
                      "#{name}[#{ps.join(", ")}]"
         | 
| 76 | 
            -
                    end
         | 
| 77 | 
            -
                  end
         | 
| 67 | 
            +
                  private
         | 
| 78 68 |  | 
| 79 | 
            -
                   | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 69 | 
            +
                  # Avoid `RBS::GenericParameterMismatchError` from like rbs_prototype_rb
         | 
| 70 | 
            +
                  #     class Array # <= RBS::GenericParameterMismatchError
         | 
| 71 | 
            +
                  #     end
         | 
| 72 | 
            +
                  def avoid_generic_parameter_mismatch_error
         | 
| 73 | 
            +
                    @known_env.class_decls.each do |type_name, m_entry|
         | 
| 74 | 
            +
                      tmp_primary_d = m_entry.decls.find { |d| !d.decl.type_params.empty? }
         | 
| 75 | 
            +
                      next unless tmp_primary_d
         | 
| 76 | 
            +
                      m_entry.decls.each do |d|
         | 
| 77 | 
            +
                        if d.decl.type_params.empty?
         | 
| 78 | 
            +
                          d.decl.type_params.replace(tmp_primary_d.decl.type_params)
         | 
| 79 | 
            +
                        end
         | 
| 85 80 | 
             
                      end
         | 
| 86 81 | 
             
                    end
         | 
| 87 82 | 
             
                  end
         | 
| @@ -98,6 +93,8 @@ module Orthoses | |
| 98 93 | 
             
                          next unless @constant_filter.nil? || @constant_filter.call(member)
         | 
| 99 94 | 
             
                        when RBS::AST::Members::Mixin
         | 
| 100 95 | 
             
                          next unless @mixin_filter.nil? || @mixin_filter.call(member)
         | 
| 96 | 
            +
                        when RBS::AST::Members::Attribute
         | 
| 97 | 
            +
                          next unless @attribute_filter.nil? || @attribute_filter.call(member)
         | 
| 101 98 | 
             
                        end
         | 
| 102 99 | 
             
                        writer.write_member(member)
         | 
| 103 100 | 
             
                      end
         | 
| @@ -0,0 +1,94 @@ | |
| 1 | 
            +
            module Orthoses
         | 
| 2 | 
            +
              class Content
         | 
| 3 | 
            +
                class HeaderBuilder
         | 
| 4 | 
            +
                  def initialize(env:)
         | 
| 5 | 
            +
                    @env = env
         | 
| 6 | 
            +
                    @resolver = RBS::TypeNameResolver.from_env(env)
         | 
| 7 | 
            +
                  end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  def build(entry:, name_hint: nil)
         | 
| 10 | 
            +
                    case entry
         | 
| 11 | 
            +
                    when RBS::Environment::ModuleEntry
         | 
| 12 | 
            +
                      build_module(entry: entry, name_hint: name_hint)
         | 
| 13 | 
            +
                    when RBS::Environment::ClassEntry
         | 
| 14 | 
            +
                      build_class(entry: entry, name_hint: name_hint)
         | 
| 15 | 
            +
                    when RBS::Environment::SingleEntry
         | 
| 16 | 
            +
                      build_interface(entry: entry, name_hint: name_hint)
         | 
| 17 | 
            +
                    else
         | 
| 18 | 
            +
                      raise
         | 
| 19 | 
            +
                    end
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  private
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  def build_module(entry:, name_hint: nil)
         | 
| 25 | 
            +
                    primary = entry.primary
         | 
| 26 | 
            +
                    full_name = name_hint || primary.decl.name.relative!
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                    self_types =
         | 
| 29 | 
            +
                      if primary.decl.self_types.empty?
         | 
| 30 | 
            +
                        nil
         | 
| 31 | 
            +
                      else
         | 
| 32 | 
            +
                        " : #{primary.decl.self_types.join(', ')}"
         | 
| 33 | 
            +
                      end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                    "module #{name_and_params(full_name, primary.decl.type_params)}#{self_types}"
         | 
| 36 | 
            +
                  end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  def build_class(entry:, name_hint: nil)
         | 
| 39 | 
            +
                    primary = entry.primary
         | 
| 40 | 
            +
                    full_name = name_hint || primary.decl.name.relative!
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                    "class #{name_and_params(full_name, primary.decl.type_params)}#{build_super_class(primary)}"
         | 
| 43 | 
            +
                  end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                  def build_super_class(primary)
         | 
| 46 | 
            +
                    return nil if primary.decl.super_class.then { |s| s.nil? || s.name.relative!.to_s.then { |n| n == "Object" || n == "Random::Base" } }
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                    context = primary.outer.length.times.map do |i|
         | 
| 49 | 
            +
                      primary.outer[0, i + 1].map(&:name).inject(:+).to_namespace.absolute!
         | 
| 50 | 
            +
                    end
         | 
| 51 | 
            +
                    context.push(RBS::Namespace.root)
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                    super_class_name = @resolver.resolve(primary.decl.super_class.name, context: context) || primary.decl.super_class.name
         | 
| 54 | 
            +
                    if primary.decl.super_class.args.empty?
         | 
| 55 | 
            +
                      if super_class_entry = @env.class_decls[super_class_name]
         | 
| 56 | 
            +
                        super_primary = super_class_entry.primary
         | 
| 57 | 
            +
                        " < #{name_and_args(super_class_name, super_primary.decl.type_params.map { :untyped })}"
         | 
| 58 | 
            +
                      else
         | 
| 59 | 
            +
                        " < #{name_and_args(super_class_name, [])}"
         | 
| 60 | 
            +
                      end
         | 
| 61 | 
            +
                    else
         | 
| 62 | 
            +
                      " < #{name_and_args(super_class_name, primary.decl.super_class.args)}"
         | 
| 63 | 
            +
                    end
         | 
| 64 | 
            +
                  end
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                  def build_interface(entry:, name_hint: nil)
         | 
| 67 | 
            +
                    full_name = name_hint || entry.decl.name.relative!
         | 
| 68 | 
            +
                    "interface #{name_and_params(full_name, entry.decl.type_params)}"
         | 
| 69 | 
            +
                  end
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                  def name_and_params(name, params)
         | 
| 72 | 
            +
                    if params.empty?
         | 
| 73 | 
            +
                      "#{name}"
         | 
| 74 | 
            +
                    else
         | 
| 75 | 
            +
                      ps = params.each.map do |param|
         | 
| 76 | 
            +
                        param.to_s
         | 
| 77 | 
            +
                      end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                      "#{name}[#{ps.join(", ")}]"
         | 
| 80 | 
            +
                    end
         | 
| 81 | 
            +
                  end
         | 
| 82 | 
            +
             | 
| 83 | 
            +
                  def name_and_args(name, args)
         | 
| 84 | 
            +
                    if name && args
         | 
| 85 | 
            +
                      if args.empty?
         | 
| 86 | 
            +
                        "#{name}"
         | 
| 87 | 
            +
                      else
         | 
| 88 | 
            +
                        "#{name}[#{args.join(", ")}]"
         | 
| 89 | 
            +
                      end
         | 
| 90 | 
            +
                    end
         | 
| 91 | 
            +
                  end
         | 
| 92 | 
            +
                end
         | 
| 93 | 
            +
              end
         | 
| 94 | 
            +
            end
         | 
    
        data/lib/orthoses/content.rb
    CHANGED
    
    | @@ -2,6 +2,7 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            require 'orthoses/content/duplication_checker'
         | 
| 4 4 | 
             
            require 'orthoses/content/environment'
         | 
| 5 | 
            +
            require 'orthoses/content/header_builder'
         | 
| 5 6 |  | 
| 6 7 | 
             
            module Orthoses
         | 
| 7 8 | 
             
              # Common interface for output.
         | 
| @@ -20,36 +21,79 @@ module Orthoses | |
| 20 21 | 
             
                attr_accessor :header
         | 
| 21 22 |  | 
| 22 23 | 
             
                def initialize(name:)
         | 
| 24 | 
            +
                  Orthoses.logger.debug("Create Orthoses::Content for #{name}")
         | 
| 23 25 | 
             
                  @name = name
         | 
| 24 26 | 
             
                  @body = []
         | 
| 25 27 | 
             
                  @header = nil
         | 
| 26 28 | 
             
                end
         | 
| 27 29 |  | 
| 28 30 | 
             
                def <<(line)
         | 
| 29 | 
            -
                  Orthoses.logger.debug("[#{name}] << #{line} on #{__FILE__}:#{__LINE__}")
         | 
| 30 31 | 
             
                  @body << line
         | 
| 31 32 | 
             
                end
         | 
| 32 33 |  | 
| 33 34 | 
             
                def concat(other)
         | 
| 34 | 
            -
                  Orthoses.logger.debug("[#{name}] concat #{other} on #{__FILE__}:#{__LINE__}")
         | 
| 35 35 | 
             
                  @body.concat(other)
         | 
| 36 36 | 
             
                end
         | 
| 37 37 |  | 
| 38 38 | 
             
                def to_rbs
         | 
| 39 | 
            -
                   | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 39 | 
            +
                  auto_header
         | 
| 40 | 
            +
                  uniqed_body_string
         | 
| 41 | 
            +
                end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                def to_decl
         | 
| 44 | 
            +
                  auto_header
         | 
| 45 | 
            +
                  uniqed_body_decl
         | 
| 43 46 | 
             
                end
         | 
| 44 47 |  | 
| 45 48 | 
             
                private
         | 
| 46 49 |  | 
| 50 | 
            +
                def original_rbs
         | 
| 51 | 
            +
                  <<~RBS
         | 
| 52 | 
            +
                    #{@header}
         | 
| 53 | 
            +
                      #{@body.join("\n")}
         | 
| 54 | 
            +
                    end
         | 
| 55 | 
            +
                  RBS
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                def uniqed_body_string
         | 
| 59 | 
            +
                  out = StringIO.new
         | 
| 60 | 
            +
                  writer = RBS::Writer.new(out: out)
         | 
| 61 | 
            +
                  writer.write_decl(uniqed_body_decl)
         | 
| 62 | 
            +
                  out.string
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                def uniqed_body_decl
         | 
| 66 | 
            +
                  buffer = RBS::Buffer.new(
         | 
| 67 | 
            +
                    name: "orthoses/content.rb",
         | 
| 68 | 
            +
                    content: original_rbs
         | 
| 69 | 
            +
                  )
         | 
| 70 | 
            +
                  parsed_decls = RBS::Parser.parse_signature(buffer)
         | 
| 71 | 
            +
                  unless parsed_decls.length == 1
         | 
| 72 | 
            +
                    raise "expect decls.length == 1, but got #{parsed_decls.length}"
         | 
| 73 | 
            +
                  end
         | 
| 74 | 
            +
                  parsed_decl = parsed_decls.first or raise
         | 
| 75 | 
            +
                  parsed_decl.tap do |decl|
         | 
| 76 | 
            +
                    DuplicationChecker.new(decl).update_decl
         | 
| 77 | 
            +
                  end
         | 
| 78 | 
            +
                rescue RBS::ParsingError
         | 
| 79 | 
            +
                  Orthoses.logger.error "```rbs\n#{original_rbs}```"
         | 
| 80 | 
            +
                  raise
         | 
| 81 | 
            +
                end
         | 
| 82 | 
            +
             | 
| 47 83 | 
             
                def auto_header
         | 
| 48 84 | 
             
                  if name.split('::').last.start_with?('_')
         | 
| 49 85 | 
             
                    self.header = "interface #{name}"
         | 
| 50 86 | 
             
                    return
         | 
| 51 87 | 
             
                  end
         | 
| 52 88 |  | 
| 89 | 
            +
                  env = Utils.rbs_environment(collection: true)
         | 
| 90 | 
            +
                  if entry = env.class_decls[TypeName(name).absolute!]
         | 
| 91 | 
            +
                    @header = Content::HeaderBuilder.new(env: env).build(entry: entry)
         | 
| 92 | 
            +
                    return
         | 
| 93 | 
            +
                  end
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                  return unless @header.nil?
         | 
| 96 | 
            +
             | 
| 53 97 | 
             
                  val = Object.const_get(name)
         | 
| 54 98 |  | 
| 55 99 | 
             
                  case val
         | 
| @@ -93,28 +137,5 @@ module Orthoses | |
| 93 137 | 
             
                    end
         | 
| 94 138 | 
             
                  end
         | 
| 95 139 | 
             
                end
         | 
| 96 | 
            -
             | 
| 97 | 
            -
                def body_uniq(rbs)
         | 
| 98 | 
            -
                  buffer = RBS::Buffer.new(
         | 
| 99 | 
            -
                    name: "orthoses/content.rb",
         | 
| 100 | 
            -
                    content: rbs
         | 
| 101 | 
            -
                  )
         | 
| 102 | 
            -
                  out = StringIO.new
         | 
| 103 | 
            -
                  writer = RBS::Writer.new(out: out)
         | 
| 104 | 
            -
                  decls = RBS::Parser.parse_signature(buffer).map do |parsed_decl|
         | 
| 105 | 
            -
                    parsed_decl.tap do |decl|
         | 
| 106 | 
            -
                      duplicate_checker = DuplicationChecker.new(decl)
         | 
| 107 | 
            -
                      decl.members.each do |member|
         | 
| 108 | 
            -
                        duplicate_checker << member
         | 
| 109 | 
            -
                      end
         | 
| 110 | 
            -
                      decl.members.replace(duplicate_checker.uniq_members)
         | 
| 111 | 
            -
                    end
         | 
| 112 | 
            -
                  end
         | 
| 113 | 
            -
                  writer.write(decls)
         | 
| 114 | 
            -
                  out.string
         | 
| 115 | 
            -
                rescue RBS::ParsingError
         | 
| 116 | 
            -
                  Orthoses.logger.error "```rbs\n#{rbs}```"
         | 
| 117 | 
            -
                  raise
         | 
| 118 | 
            -
                end
         | 
| 119 140 | 
             
              end
         | 
| 120 141 | 
             
            end
         | 
    
        data/lib/orthoses/load_rbs.rb
    CHANGED
    
    | @@ -11,14 +11,7 @@ module Orthoses | |
| 11 11 |  | 
| 12 12 | 
             
                def call
         | 
| 13 13 | 
             
                  @loader.call.tap do |store|
         | 
| 14 | 
            -
                    env = Content::Environment. | 
| 15 | 
            -
                    @paths.each do |path|
         | 
| 16 | 
            -
                      Orthoses.logger.debug("Load #{path}")
         | 
| 17 | 
            -
                      buffer = RBS::Buffer.new(name: path.to_s, content: File.read(path.to_s, encoding: "UTF-8"))
         | 
| 18 | 
            -
                      RBS::Parser.parse_signature(buffer).each do |decl|
         | 
| 19 | 
            -
                        env << decl
         | 
| 20 | 
            -
                      end
         | 
| 21 | 
            -
                    end
         | 
| 14 | 
            +
                    env = Content::Environment.load_from_paths(@paths)
         | 
| 22 15 | 
             
                    env.write_to(store: store)
         | 
| 23 16 | 
             
                  end
         | 
| 24 17 | 
             
                end
         | 
    
        data/lib/orthoses/mixin.rb
    CHANGED
    
    | @@ -37,15 +37,7 @@ module Orthoses | |
| 37 37 | 
             
                      next unless known_type_params.nil? || known_type_params.empty?
         | 
| 38 38 | 
             
                      next unless @if.nil? || @if.call(base_mod, how, mod)
         | 
| 39 39 |  | 
| 40 | 
            -
                       | 
| 41 | 
            -
                        # avoid RecursiveAncestorError
         | 
| 42 | 
            -
                        content = store[mod_name]
         | 
| 43 | 
            -
                        if content.header.nil?
         | 
| 44 | 
            -
                          content.header = "module #{Utils.module_to_type_name(mod)} : ::BasicObject"
         | 
| 45 | 
            -
                        end
         | 
| 46 | 
            -
                      else
         | 
| 47 | 
            -
                        store[mod_name]
         | 
| 48 | 
            -
                      end
         | 
| 40 | 
            +
                      store[mod_name]
         | 
| 49 41 |  | 
| 50 42 | 
             
                      "#{how} #{mod_name}"
         | 
| 51 43 | 
             
                    end
         | 
| @@ -3,11 +3,12 @@ module Orthoses | |
| 3 3 | 
             
              #     use Orthoses::RBSPrototypeRB,
         | 
| 4 4 | 
             
              #       paths: Dir.glob("lib/**/*.rb")
         | 
| 5 5 | 
             
              class RBSPrototypeRB
         | 
| 6 | 
            -
                def initialize(loader, paths:, constant_filter: nil, mixin_filter: nil)
         | 
| 6 | 
            +
                def initialize(loader, paths:, constant_filter: nil, mixin_filter: nil, attribute_filter: nil)
         | 
| 7 7 | 
             
                  @loader = loader
         | 
| 8 8 | 
             
                  @paths = paths
         | 
| 9 9 | 
             
                  @constant_filter = constant_filter
         | 
| 10 10 | 
             
                  @mixin_filter = mixin_filter
         | 
| 11 | 
            +
                  @attribute_filter = attribute_filter
         | 
| 11 12 | 
             
                end
         | 
| 12 13 |  | 
| 13 14 | 
             
                def call
         | 
| @@ -15,6 +16,7 @@ module Orthoses | |
| 15 16 | 
             
                    parser = RBS::Prototype::RB.new
         | 
| 16 17 | 
             
                    @paths.each do |path|
         | 
| 17 18 | 
             
                      begin
         | 
| 19 | 
            +
                        Orthoses.logger.debug("parse #{path} by RBS::Prototype::RB")
         | 
| 18 20 | 
             
                        parser.parse File.read(path.to_s)
         | 
| 19 21 | 
             
                      rescue => err
         | 
| 20 22 | 
             
                        Orthoses.logger.error("Parse error #{err.inspect} by RBS::Prototype::RB #{path}")
         | 
| @@ -23,6 +25,7 @@ module Orthoses | |
| 23 25 | 
             
                    env = Orthoses::Content::Environment.new(
         | 
| 24 26 | 
             
                      constant_filter: @constant_filter,
         | 
| 25 27 | 
             
                      mixin_filter: @mixin_filter,
         | 
| 28 | 
            +
                      attribute_filter: @attribute_filter,
         | 
| 26 29 | 
             
                    )
         | 
| 27 30 | 
             
                    parser.decls.each do |decl|
         | 
| 28 31 | 
             
                      env << decl
         | 
    
        data/lib/orthoses/utils.rb
    CHANGED
    
    | @@ -46,17 +46,39 @@ module Orthoses | |
| 46 46 | 
             
                  RBS::Namespace.parse(name).to_type_name
         | 
| 47 47 | 
             
                end
         | 
| 48 48 |  | 
| 49 | 
            -
                 | 
| 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 | 
            +
             | 
| 71 | 
            +
                def self.rbs_environment(library: nil, collection: false, cache: true)
         | 
| 50 72 | 
             
                  @env_cache ||= {}
         | 
| 51 | 
            -
                  if hit = @env_cache[[library, collection]]
         | 
| 73 | 
            +
                  if cache && hit = @env_cache[[library, collection]]
         | 
| 52 74 | 
             
                    return hit
         | 
| 53 75 | 
             
                  end
         | 
| 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
         | 
| @@ -71,8 +93,9 @@ module Orthoses | |
| 71 93 | 
             
                    end
         | 
| 72 94 | 
             
                  end
         | 
| 73 95 |  | 
| 74 | 
            -
                   | 
| 75 | 
            -
             | 
| 96 | 
            +
                  RBS::Environment.from_loader(loader).resolve_type_names.tap do |env|
         | 
| 97 | 
            +
                    @env_cache[[library, collection]] = env if cache
         | 
| 98 | 
            +
                  end
         | 
| 76 99 | 
             
                end
         | 
| 77 100 |  | 
| 78 101 | 
             
                def self.object_to_rbs(object, strict:)
         | 
| @@ -121,6 +144,9 @@ module Orthoses | |
| 121 144 | 
             
                        "Hash[#{keys.join(' | ')}, #{values.join(' | ')}]"
         | 
| 122 145 | 
             
                      end
         | 
| 123 146 | 
             
                    end
         | 
| 147 | 
            +
                  when Range
         | 
| 148 | 
            +
                    type = object_to_rbs(object.begin || object.end, strict: false)
         | 
| 149 | 
            +
                    "Range[#{type}]"
         | 
| 124 150 | 
             
                  when ARGF
         | 
| 125 151 | 
             
                    # see also https://github.com/ruby/rbs/pull/975
         | 
| 126 152 | 
             
                    'untyped'
         | 
    
        data/lib/orthoses/version.rb
    CHANGED
    
    
    
        data/lib/orthoses.rb
    CHANGED
    
    
    
        data/sig/orthoses/_call.rbs
    CHANGED
    
    
| @@ -0,0 +1,11 @@ | |
| 1 | 
            +
            # THIS IS GENERATED CODE from `$ rake generate_self_sig`
         | 
| 2 | 
            +
             | 
| 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
         | 
| 11 | 
            +
            end
         | 
| @@ -0,0 +1,9 @@ | |
| 1 | 
            +
            # THIS IS GENERATED CODE from `$ rake generate_self_sig`
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class Orthoses::Attribute
         | 
| 4 | 
            +
              def initialize: (Orthoses::_Call loader) -> void
         | 
| 5 | 
            +
              def call: () -> Orthoses::store
         | 
| 6 | 
            +
              private
         | 
| 7 | 
            +
              def each_definition: (untyped call_tracer) { (untyped) -> untyped } -> untyped
         | 
| 8 | 
            +
              @loader: Orthoses::_Call
         | 
| 9 | 
            +
            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
         | 
    
        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,10 @@ | |
| 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
         | 
| 7 | 
            +
              def drop_known_method_definition: (untyped uniq_map) -> untyped
         | 
| 8 | 
            +
              def member_to_s: (untyped member) -> untyped
         | 
| 9 | 
            +
              def member_key: (untyped member) -> untyped
         | 
| 4 10 | 
             
            end
         | 
| @@ -1,13 +1,23 @@ | |
| 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 | 
            +
              private
         | 
| 11 | 
            +
              # Avoid `RBS::GenericParameterMismatchError` from like rbs_prototype_rb
         | 
| 12 | 
            +
              #     class Array # <= RBS::GenericParameterMismatchError
         | 
| 13 | 
            +
              #     end
         | 
| 14 | 
            +
              def avoid_generic_parameter_mismatch_error: () -> untyped
         | 
| 15 | 
            +
              def decls_to_lines: (untyped decls) -> untyped
         | 
| 4 16 | 
             
              type constant_filter = ^(RBS::AST::Declarations::Constant) -> boolish
         | 
| 5 17 | 
             
              type mixin_filter = ^(RBS::AST::Members::Mixin) -> boolish
         | 
| 18 | 
            +
              type attribute_filter = ^(RBS::AST::Members::Attribute) -> boolish
         | 
| 6 19 | 
             
              @env: RBS::Environment
         | 
| 7 20 | 
             
              @constant_filter: constant_filter?
         | 
| 8 21 | 
             
              @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
         | 
| 22 | 
            +
              @attribute_filter: attribute_filter?
         | 
| 13 23 | 
             
            end
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            # THIS IS GENERATED CODE from `$ rake generate_self_sig`
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class Orthoses::Content::HeaderBuilder
         | 
| 4 | 
            +
              def initialize: (env: untyped) -> void
         | 
| 5 | 
            +
              def build: (entry: untyped, ?name_hint: untyped?) -> untyped
         | 
| 6 | 
            +
              private
         | 
| 7 | 
            +
              def build_module: (entry: untyped, ?name_hint: untyped?) -> ::String
         | 
| 8 | 
            +
              def build_class: (entry: untyped, ?name_hint: untyped?) -> ::String
         | 
| 9 | 
            +
              def build_super_class: (untyped primary) -> (nil | untyped)
         | 
| 10 | 
            +
              def build_interface: (entry: untyped, ?name_hint: untyped?) -> ::String
         | 
| 11 | 
            +
              def name_and_params: (untyped name, untyped params) -> ::String
         | 
| 12 | 
            +
              def name_and_args: (untyped name, untyped args) -> (::String | nil)
         | 
| 13 | 
            +
            end
         | 
    
        data/sig/orthoses/content.rbs
    CHANGED
    
    | @@ -8,4 +8,14 @@ class Orthoses::Content | |
| 8 8 | 
             
              def <<: (String) -> void
         | 
| 9 9 | 
             
              def concat: (Array[String]) -> void
         | 
| 10 10 | 
             
              def to_rbs: () -> String
         | 
| 11 | 
            +
              def to_decl: () -> untyped
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              private
         | 
| 14 | 
            +
              def original_rbs: () -> ::String
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              def uniqed_body_string: () -> String
         | 
| 17 | 
            +
              def uniqed_body_decl: () -> RBS::AST::Declarations::t
         | 
| 18 | 
            +
              def auto_header: () -> (nil | untyped)
         | 
| 19 | 
            +
              def temporary_type_params: (untyped name) -> untyped
         | 
| 20 | 
            +
              def type_params: (untyped name) -> untyped
         | 
| 11 21 | 
             
            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,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
    
    | @@ -1,11 +1,9 @@ | |
| 1 1 | 
             
            # THIS IS GENERATED CODE from `$ rake generate_self_sig`
         | 
| 2 2 |  | 
| 3 3 | 
             
            module Orthoses::Utils
         | 
| 4 | 
            -
              UNBOUND_NAME_METHOD: UnboundMethod
         | 
| 5 | 
            -
             | 
| 6 4 | 
             
              def self.unautoload!: () -> void
         | 
| 7 5 |  | 
| 8 | 
            -
              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
         | 
| 9 7 |  | 
| 10 8 | 
             
              def self.rbs_defined_const?: (String name, ?library: (String | Array[String])?, ?collection: boolish) -> bool
         | 
| 11 9 |  | 
| @@ -13,10 +11,14 @@ module Orthoses::Utils | |
| 13 11 |  | 
| 14 12 | 
             
              def self.rbs_type_name: (String) -> RBS::TypeName
         | 
| 15 13 |  | 
| 16 | 
            -
               | 
| 14 | 
            +
              attr_accessor self.rbs_collection_pathname: Pathname
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              def self.rbs_environment: (?library: String | Array[String] | nil, ?collection: boolish, ?cache: boolish) -> RBS::Environment
         | 
| 17 17 |  | 
| 18 18 | 
             
              def self.object_to_rbs: (untyped object, strict: bool) -> String
         | 
| 19 19 |  | 
| 20 | 
            +
              UNBOUND_NAME_METHOD: UnboundMethod
         | 
| 21 | 
            +
             | 
| 20 22 | 
             
              def self.module_name: (Module mod) -> String?
         | 
| 21 23 |  | 
| 22 24 | 
             
              def self.module_to_type_name: (Module) -> RBS::TypeName?
         | 
    
        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.6.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-01 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rbs
         | 
| @@ -36,13 +36,19 @@ files: | |
| 36 36 | 
             
            - Gemfile.lock
         | 
| 37 37 | 
             
            - LICENSE.txt
         | 
| 38 38 | 
             
            - README.md
         | 
| 39 | 
            +
            - examples/minitest/Rakefile
         | 
| 40 | 
            +
            - examples/simple_middleware.rb
         | 
| 41 | 
            +
            - examples/simple_middleware.rbs
         | 
| 39 42 | 
             
            - lib/orthoses.rb
         | 
| 43 | 
            +
            - lib/orthoses/attribute.rb
         | 
| 44 | 
            +
            - lib/orthoses/avoid_recursive_ancestor_error.rb
         | 
| 40 45 | 
             
            - lib/orthoses/builder.rb
         | 
| 41 46 | 
             
            - lib/orthoses/call_tracer.rb
         | 
| 42 47 | 
             
            - lib/orthoses/constant.rb
         | 
| 43 48 | 
             
            - lib/orthoses/content.rb
         | 
| 44 49 | 
             
            - lib/orthoses/content/duplication_checker.rb
         | 
| 45 50 | 
             
            - lib/orthoses/content/environment.rb
         | 
| 51 | 
            +
            - lib/orthoses/content/header_builder.rb
         | 
| 46 52 | 
             
            - lib/orthoses/create_file_by_name.rb
         | 
| 47 53 | 
             
            - lib/orthoses/delegate_class.rb
         | 
| 48 54 | 
             
            - lib/orthoses/filter.rb
         | 
| @@ -61,6 +67,9 @@ files: | |
| 61 67 | 
             
            - sig/orthoses.rbs
         | 
| 62 68 | 
             
            - sig/orthoses/_call.rbs
         | 
| 63 69 | 
             
            - sig/orthoses/_middle_ware.rbs
         | 
| 70 | 
            +
            - sig/orthoses/attribute.rbs
         | 
| 71 | 
            +
            - sig/orthoses/attribute/hook.rbs
         | 
| 72 | 
            +
            - sig/orthoses/avoid_recursive_ancestor_error.rbs
         | 
| 64 73 | 
             
            - sig/orthoses/builder.rbs
         | 
| 65 74 | 
             
            - sig/orthoses/builder/call_logable.rbs
         | 
| 66 75 | 
             
            - sig/orthoses/call_tracer.rbs
         | 
| @@ -69,6 +78,7 @@ files: | |
| 69 78 | 
             
            - sig/orthoses/content.rbs
         | 
| 70 79 | 
             
            - sig/orthoses/content/duplication_checker.rbs
         | 
| 71 80 | 
             
            - sig/orthoses/content/environment.rbs
         | 
| 81 | 
            +
            - sig/orthoses/content/header_builder.rbs
         | 
| 72 82 | 
             
            - sig/orthoses/create_file_by_name.rbs
         | 
| 73 83 | 
             
            - sig/orthoses/delegate_class.rbs
         | 
| 74 84 | 
             
            - sig/orthoses/filter.rbs
         |