yard-sorbet 0.3.0 → 0.4.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/lib/yard-sorbet/struct_handler.rb +8 -4
- data/lib/yard-sorbet/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24bbf6faf77f9a54ad0c74bacef4828729c182352464734bb587ef6f1a035e9a
|
4
|
+
data.tar.gz: c68e0b16d0f7cd81f1f03dac293aa7fd7f87504c134c1de34c3cf2e2600ff6d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65bbdc49da863973cd60926c8b898a789d4b740009453a698dfa0531eaa742805d81e72eb95e1411625a6ecf25029c85b6dc863bcf67928035aeacaa4766fb55
|
7
|
+
data.tar.gz: 4aba39bc2d129e99910d421f47fa01fb9178078da6bb1ba5b1e8da3c847e39b96927342e5c774db1ec71a46475a2eeed0ae12be4eb729bb278bfbf2fcd79e720
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
#
|
4
|
+
# Handles all `const`/`prop` calls, creating accessor methods, and compiles them for later usage at the class level
|
5
5
|
# in creating a constructor
|
6
6
|
class YARDSorbet::StructHandler < YARD::Handlers::Ruby::Base
|
7
7
|
extend T::Sig
|
8
8
|
|
9
|
-
handles method_call(:const)
|
9
|
+
handles method_call(:const), method_call(:prop)
|
10
10
|
namespace_only
|
11
11
|
|
12
12
|
sig { void }
|
@@ -39,12 +39,16 @@ class YARDSorbet::StructHandler < YARD::Handlers::Ruby::Base
|
|
39
39
|
docstring.add_tag(YARD::Tags::Tag.new(:return, '', types))
|
40
40
|
object.docstring = docstring.to_raw
|
41
41
|
|
42
|
-
# Register the object explicitly as an attribute
|
42
|
+
# Register the object explicitly as an attribute.
|
43
|
+
# While `const` attributes are immutable, `prop` attributes may be reassigned.
|
44
|
+
if statement.method_name.source == 'prop'
|
45
|
+
namespace.attributes[scope][name][:write] = object
|
46
|
+
end
|
43
47
|
namespace.attributes[scope][name][:read] = object
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
47
|
-
# Class-level handler that folds all `const` declarations into the constructor documentation
|
51
|
+
# Class-level handler that folds all `const` and `prop` declarations into the constructor documentation
|
48
52
|
# this needs to be injected as a module otherwise the default Class handler will overwrite documentation
|
49
53
|
module YARDSorbet::StructClassHandler
|
50
54
|
extend T::Sig
|
data/lib/yard-sorbet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-sorbet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Douglas Eichelberger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codecov
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.12.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.12.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop-performance
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: 0.6.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: 0.6.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: simplecov
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|