orthoses 0.6.0 → 0.7.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: 3fe5907a7edff87d73372b0e6f556d5f3b08a3ae6d7407447f249a25953d069e
4
- data.tar.gz: 7564345ffdc6363a5ba03bb9c70299b17cb15cdb3cc501bcbd3b221c7b0a823a
3
+ metadata.gz: 894390a9b9736bc6c773da2d8522b76a47a4f345f1eb48c847b4dc2cf691cfe4
4
+ data.tar.gz: 9189fdd9d19a953227093f99cd04e8a20f258e231e40b40ed5e7582cd5ac107c
5
5
  SHA512:
6
- metadata.gz: 35acabbfbd4ab4c549d8cefdecc829074ade2bc041093432b3a1ae52c095f1d2e8a4420d30754dfd0a1dfb9d09f999fb2885b4f87c7e14c2c3386afff886082f
7
- data.tar.gz: 01f8881d042a106e720574902abc2227161c65c78b35277618aea2343f8be43dfdcb4d94735ce2f5a7fd62ffb5137e5c928e0bd1e9dd50cd583ecd6819c80d38
6
+ metadata.gz: 90d06b917b9fb9aa88a18bae14bd792fe85520a8d8cf9f75c8d422f080cfe992036f3b1d2b9e115f1a6ff315478899a2b275d6ae99bdd6c5598bdcc21e3ddf56
7
+ data.tar.gz: 4d134a532af9973901e87fa48d1e96d9ca1469b46fa266d548476d252f8651dce94b40ee3de799dd7aa10f5d961e06d330048b5c833af88eee536965779dd131
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orthoses (0.6.0)
4
+ orthoses (0.7.0)
5
5
  rbs (~> 2.0)
6
6
 
7
7
  GEM
@@ -7,16 +7,23 @@ module Orthoses
7
7
  def call
8
8
  @loader.call.tap do |store|
9
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
10
+ set_object_mixins_recursive(store, "Object", object_mixins)
11
+
16
12
  object_mixins.each_key do |object_mixin|
17
13
  store[object_mixin].header = "module #{object_mixin} : BasicObject"
18
14
  end
19
15
  end
20
16
  end
17
+
18
+ def set_object_mixins_recursive(store, name, object_mixins)
19
+ store[name].to_decl.members.each do |member|
20
+ case member
21
+ when RBS::AST::Members::Mixin
22
+ member_name = member.name.relative!.to_s
23
+ object_mixins[member_name] = true
24
+ set_object_mixins_recursive(store, member_name, object_mixins)
25
+ end
26
+ end
27
+ end
21
28
  end
22
29
  end
@@ -27,10 +27,14 @@ module Orthoses
27
27
  Orthoses::Utils.each_const_recursive(base, on_error: @on_error) do |current, const, val|
28
28
  next if current.singleton_class?
29
29
  next if Utils.module_name(current).nil?
30
- next if val.kind_of?(Module)
31
30
  next if cache[[current, const]]
32
31
  cache[[current, const]] = true
33
32
 
33
+ if val.kind_of?(Module)
34
+ will_add_key_and_content << [Utils.module_name(val), nil]
35
+ next
36
+ end
37
+
34
38
  rbs = Orthoses::Utils.object_to_rbs(val, strict: @strict)
35
39
  next unless rbs
36
40
  next unless @if.nil? || @if.call(current, const, val, rbs)
@@ -38,8 +42,12 @@ module Orthoses
38
42
  will_add_key_and_content << [Utils.module_name(current), "#{const}: #{rbs}"]
39
43
  end
40
44
  end
45
+
41
46
  will_add_key_and_content.each do |name, line|
42
- store[name] << line
47
+ next unless name
48
+ content = store[name]
49
+ next unless line
50
+ content << line
43
51
  end
44
52
  end
45
53
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orthoses
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.0"
5
5
  end
@@ -3,5 +3,6 @@
3
3
  class Orthoses::AvoidRecursiveAncestorError
4
4
  def initialize: (Orthoses::_Call loader) -> void
5
5
  def call: () -> Orthoses::store
6
+ def set_object_mixins_recursive: (untyped store, untyped name, untyped object_mixins) -> untyped
6
7
  @loader: Orthoses::_Call
7
8
  end
@@ -1,8 +1,8 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  class Orthoses::CallTracer
4
- attr_accessor result: Array[[ Method, Hash[Symbol, untyped] ]]
5
4
  def initialize: () -> void
6
5
 
7
6
  def trace: [T] (Method | UnboundMethod) ?{ () -> T } -> T
7
+ attr_accessor result: Array[[ Method, Hash[Symbol, untyped] ]]
8
8
  end
@@ -1,9 +1,9 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  class Orthoses::ConstLoadError < ::StandardError
4
+ def initialize: (root: Module, const: Symbol, error: untyped) -> void
5
+ def message: () -> ::String
4
6
  attr_reader root: Module
5
7
  attr_reader const: Symbol
6
8
  attr_reader error: untyped
7
- def initialize: (root: Module, const: Symbol, error: untyped) -> void
8
- def message: () -> ::String
9
9
  end
@@ -1,9 +1,6 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  class Orthoses::Content
4
- attr_reader name: String
5
- attr_reader body: Array[String]
6
- attr_accessor header: String?
7
4
  def initialize: (name: String) -> void
8
5
  def <<: (String) -> void
9
6
  def concat: (Array[String]) -> void
@@ -18,4 +15,7 @@ class Orthoses::Content
18
15
  def auto_header: () -> (nil | untyped)
19
16
  def temporary_type_params: (untyped name) -> untyped
20
17
  def type_params: (untyped name) -> untyped
18
+ attr_reader name: String
19
+ attr_reader body: Array[String]
20
+ attr_accessor header: String?
21
21
  end
@@ -11,14 +11,10 @@ module Orthoses::Utils
11
11
 
12
12
  def self.rbs_type_name: (String) -> RBS::TypeName
13
13
 
14
- attr_accessor self.rbs_collection_pathname: Pathname
15
-
16
14
  def self.rbs_environment: (?library: String | Array[String] | nil, ?collection: boolish, ?cache: boolish) -> RBS::Environment
17
15
 
18
16
  def self.object_to_rbs: (untyped object, strict: bool) -> String
19
17
 
20
- UNBOUND_NAME_METHOD: UnboundMethod
21
-
22
18
  def self.module_name: (Module mod) -> String?
23
19
 
24
20
  def self.module_to_type_name: (Module) -> RBS::TypeName?
@@ -26,4 +22,8 @@ module Orthoses::Utils
26
22
  def self.known_type_params: (Module | String) -> Array[RBS::AST::TypeParam]
27
23
 
28
24
  def self.new_store: () -> Orthoses::store
25
+
26
+ UNBOUND_NAME_METHOD: UnboundMethod
27
+
28
+ attr_accessor self.rbs_collection_pathname: Pathname
29
29
  end
data/sig/orthoses.rbs CHANGED
@@ -1,7 +1,7 @@
1
1
  # THIS IS GENERATED CODE from `$ rake generate_self_sig`
2
2
 
3
3
  module Orthoses
4
- VERSION: "0.6.0"
4
+ VERSION: "0.7.0"
5
5
 
6
6
  attr_accessor self.logger: ::Logger
7
7
 
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.6.0
4
+ version: 0.7.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-06-01 00:00:00.000000000 Z
11
+ date: 2022-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs