orthoses 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db149183688863139dfc513f92a150464497d1df409c495377817b4d3671db00
4
- data.tar.gz: a02eb903127a7f6daf17750b9263ffee63a880b381ccfc47e76aa82e52252af3
3
+ metadata.gz: 3fe5907a7edff87d73372b0e6f556d5f3b08a3ae6d7407447f249a25953d069e
4
+ data.tar.gz: 7564345ffdc6363a5ba03bb9c70299b17cb15cdb3cc501bcbd3b221c7b0a823a
5
5
  SHA512:
6
- metadata.gz: 0ada92bd790f9ff1fd4b4e1293c1d4dad77c08c3c2e39f4513655ce910db7239e2a9e34373395e5abb4025d341c3596ef48b5dd46c05312cf6e2e8ec92152558
7
- data.tar.gz: cb126e961ab83cc8ce683aa852279bac3a8cd166d73cd9f28f9e13cb482f8949d4b2f48928d617c2e4804b558160aea2feb6b91e66d91bfc0de86822869ba030
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.5.0)
4
+ orthoses (0.6.0)
5
5
  rbs (~> 2.0)
6
6
 
7
7
  GEM
@@ -46,6 +46,28 @@ module Orthoses
46
46
  RBS::Namespace.parse(name).to_type_name
47
47
  end
48
48
 
49
+ class << self
50
+ # Generated scripts are not always located in the root.
51
+ # By default, it follows the upper level directory from the current directory
52
+ # to find the rbs_collection.yaml file and set it to `rbs_collection_pathname`.
53
+ # It can be reconfigured if necessary.
54
+ attr_accessor :rbs_collection_pathname
55
+ end
56
+ # set default
57
+ self.rbs_collection_pathname = ->() {
58
+ begin
59
+ start = here = Dir.pwd
60
+ until ok = RBS::Collection::Config::PATH.exist?
61
+ Dir.chdir("..")
62
+ return nil if Dir.pwd == here
63
+ here = Dir.pwd
64
+ end
65
+ Pathname(here) + RBS::Collection::Config::PATH
66
+ ensure
67
+ Dir.chdir(start)
68
+ end
69
+ }.call
70
+
49
71
  def self.rbs_environment(library: nil, collection: false, cache: true)
50
72
  @env_cache ||= {}
51
73
  if cache && hit = @env_cache[[library, collection]]
@@ -54,9 +76,9 @@ module Orthoses
54
76
 
55
77
  loader = RBS::EnvironmentLoader.new
56
78
 
57
- if collection
58
- lock = RBS::Collection::Config::PATH&.then { |p| RBS::Collection::Config.lockfile_of(p) }
59
- loader.add_collection(lock) if lock
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orthoses
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  end
@@ -1,5 +1,5 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  interface Orthoses::_Call
4
- def call: () -> Hash[String, Orthoses::Content]
4
+ def call: () -> Orthoses::store
5
5
  end
@@ -1,4 +1,11 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  module Orthoses::Attribute::Hook
4
+ def attr: (*untyped names) -> untyped
5
+
6
+ def attr_accessor: (*untyped names) -> untyped
7
+
8
+ def attr_reader: (*untyped names) -> untyped
9
+
10
+ def attr_writer: (*untyped names) -> untyped
4
11
  end
@@ -1,4 +1,9 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  class Orthoses::Attribute
4
+ def initialize: (Orthoses::_Call loader) -> void
5
+ def call: () -> Orthoses::store
6
+ private
7
+ def each_definition: (untyped call_tracer) { (untyped) -> untyped } -> untyped
8
+ @loader: Orthoses::_Call
4
9
  end
@@ -1,7 +1,7 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  class Orthoses::AvoidRecursiveAncestorError
4
- @loader: Orthoses::_Call
5
- include Orthoses::_MiddleWare
6
4
  def initialize: (Orthoses::_Call loader) -> void
5
+ def call: () -> Orthoses::store
6
+ @loader: Orthoses::_Call
7
7
  end
@@ -1,4 +1,5 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  module Orthoses::Builder::CallLogable
4
+ def call: () -> untyped
4
5
  end
@@ -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
@@ -2,5 +2,7 @@
2
2
 
3
3
  class Orthoses::CallTracer
4
4
  attr_accessor result: Array[[ Method, Hash[Symbol, untyped] ]]
5
+ def initialize: () -> void
6
+
5
7
  def trace: [T] (Method | UnboundMethod) ?{ () -> T } -> T
6
8
  end
@@ -5,4 +5,5 @@ class Orthoses::ConstLoadError < ::StandardError
5
5
  attr_reader const: Symbol
6
6
  attr_reader error: untyped
7
7
  def initialize: (root: Module, const: Symbol, error: untyped) -> void
8
+ def message: () -> ::String
8
9
  end
@@ -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
- include Orthoses::_MiddleWare
6
- def initialize: (Orthoses::_Call loader, ?if: ^(Module, Symbol, untyped) -> boolish, ?on_error: ^(Orthoses::ConstLoadError) -> void) -> void
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
- def initialize: (?constant_filter: constant_filter?, ?mixin_filter: mixin_filter?) -> void
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
@@ -1,4 +1,13 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  class Orthoses::Content::HeaderBuilder
4
+ def initialize: (env: untyped) -> void
5
+ def build: (entry: untyped, ?name_hint: untyped?) -> untyped
6
+ private
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)
4
13
  end
@@ -8,7 +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
+
11
13
  private
14
+ def original_rbs: () -> ::String
15
+
12
16
  def uniqed_body_string: () -> String
13
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
14
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
@@ -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
@@ -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
@@ -1,4 +1,6 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  class Orthoses::Mixin
4
+ def initialize: (untyped loader, ?if: untyped?) -> void
5
+ def call: () -> untyped
4
6
  end
@@ -1,7 +1,7 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  class Orthoses::ObjectSpaceAll
4
- @loader: Orthoses::_Call
5
- include Orthoses::_MiddleWare
6
4
  def initialize: (Orthoses::_Call loader, ?if: ^(Module) -> boolish) -> void
5
+ def call: () -> Orthoses::store
6
+ @loader: Orthoses::_Call
7
7
  end
data/sig/orthoses/pp.rbs CHANGED
@@ -1,4 +1,6 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  class Orthoses::PP
4
+ def initialize: (untyped loader) -> void
5
+ def call: () -> untyped
4
6
  end
@@ -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
@@ -1,4 +1,6 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  class Orthoses::Store
4
+ def initialize: (untyped loader) -> void
5
+ def call: () -> untyped
4
6
  end
data/sig/orthoses/tap.rbs CHANGED
@@ -1,7 +1,7 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  class Orthoses::Tap
4
- @loader: Orthoses::_Call
5
- include Orthoses::_MiddleWare
6
4
  def initialize: (Orthoses::_Call loader) -> void
5
+ def call: () -> Orthoses::store
6
+ @loader: Orthoses::_Call
7
7
  end
@@ -3,7 +3,7 @@
3
3
  module Orthoses::Utils
4
4
  def self.unautoload!: () -> void
5
5
 
6
- def self.each_const_recursive: (Module root, ?cache: Hash[untyped, true], ?on_error: ^(Orthoses::ConstLoadError) -> void?) ?{ (Module, Symbol, untyped) -> void } -> void
6
+ def self.each_const_recursive: (Module root, ?cache: Hash[untyped, true], ?on_error: ^(Orthoses::ConstLoadError) -> void) ?{ (Module, Symbol, untyped) -> void } -> void
7
7
 
8
8
  def self.rbs_defined_const?: (String name, ?library: (String | Array[String])?, ?collection: boolish) -> bool
9
9
 
@@ -11,10 +11,14 @@ module Orthoses::Utils
11
11
 
12
12
  def self.rbs_type_name: (String) -> RBS::TypeName
13
13
 
14
- def self.rbs_environment: (?library: String | Array[String] | nil, ?collection: boolish) -> RBS::Environment
14
+ attr_accessor self.rbs_collection_pathname: Pathname
15
+
16
+ def self.rbs_environment: (?library: String | Array[String] | nil, ?collection: boolish, ?cache: boolish) -> RBS::Environment
15
17
 
16
18
  def self.object_to_rbs: (untyped object, strict: bool) -> String
17
19
 
20
+ UNBOUND_NAME_METHOD: UnboundMethod
21
+
18
22
  def self.module_name: (Module mod) -> String?
19
23
 
20
24
  def self.module_to_type_name: (Module) -> RBS::TypeName?
@@ -22,6 +26,4 @@ module Orthoses::Utils
22
26
  def self.known_type_params: (Module | String) -> Array[RBS::AST::TypeParam]
23
27
 
24
28
  def self.new_store: () -> Orthoses::store
25
-
26
- UNBOUND_NAME_METHOD: UnboundMethod
27
29
  end
@@ -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
@@ -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
@@ -1,9 +1,9 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  module Orthoses
4
+ VERSION: "0.6.0"
5
+
4
6
  attr_accessor self.logger: ::Logger
5
7
 
6
8
  type store = Hash[String, Orthoses::Content]
7
-
8
- VERSION: "0.4.0"
9
9
  end
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.5.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-05-30 00:00:00.000000000 Z
11
+ date: 2022-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs