yard-sig 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8a30d8e37b42f9db474cacba8fe768ae90129eb452cedaa105de1a28995a415
4
- data.tar.gz: b5ef51eedc71a75d8875f392e93f09f11257b7f91ad88222ee28df64dd9bf7df
3
+ metadata.gz: a5f0199099b90174466cf9c16956ad076ebef5c79a371eb28bd96e9f7ead2195
4
+ data.tar.gz: 1760b6025f143dc79fdb34cf48f8f4cc2779047fbfe5203e74bf5a633e4b1eaa
5
5
  SHA512:
6
- metadata.gz: cebe6a8c8697513117acd7080217942cd4320549466a710f780b5f38f0d3d57652121eff85b435d463168f9fed75ddba67b575b25845de311a812abfe3d0891c
7
- data.tar.gz: eb84fde03e6b369e4445cb31ae5348149da6eaf43952084036b5601045b88cb404f80308315091149247627631e6a3ce23da7dbb4a08aeee1c08a4a9b70fca6f
6
+ metadata.gz: 18333b749e23f6da2ab2f6b946e8c1fce265fd1fa9c4ebbd6b108d93dd8e4226b0ef513b18e1ceafa151511a09f9e6161bc92a1067fd826fc68e4440da81de1a
7
+ data.tar.gz: 5eb6cfcc8a229cd0550bd447db8c9397578ef51f67c178d739f22af3e008d7894ed3dc85bdeedb0f888da46d0fa0cc4dbdfe32a615cca3a4709a1d08201cd7b7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.2] - 2024-01-15
4
+
5
+ - fix: support keyword arguments
6
+
3
7
  ## [0.2.1] - 2024-01-08
4
8
 
5
9
  - fix: use the hash specific syntax
data/lib/yard-sig/sig.rb CHANGED
@@ -25,12 +25,16 @@ module YardSig
25
25
  @rbs_method_type ||= RBS::Parser.parse_method_type(@source)
26
26
  end
27
27
 
28
- def rbs_type_to_tags(rbs_type, within_block: false)
28
+ def rbs_type_to_tags(rbs_type, within_block: false) # rubocop:disable Metrics/AbcSize
29
29
  positionals = rbs_type.required_positionals + rbs_type.optional_positionals
30
30
 
31
31
  tags = positionals.map.with_index do |param, i|
32
32
  build_param_tag(param, :positionals, pos: i, within_block: within_block)
33
33
  end
34
+
35
+ tags += rbs_type.required_keywords.map { |name, type| build_param_tag_for_keyword(name, type) }
36
+ tags += rbs_type.optional_keywords.map { |name, type| build_param_tag_for_keyword(name, type) }
37
+
34
38
  tags << build_param_tag(rbs_type.rest_positionals, :rest, within_block: within_block)
35
39
  tags << build_param_tag(rbs_type.rest_keywords, :keyrest, within_block: within_block)
36
40
  tags << build_return_tag(rbs_type.return_type, within_block: within_block)
@@ -56,6 +60,13 @@ module YardSig
56
60
  YARD::Tags::Tag.new(tag_name, "", yard_types, name)
57
61
  end
58
62
 
63
+ def build_param_tag_for_keyword(name, type)
64
+ yard_types = to_yard_type(type.type)
65
+ return unless yard_types
66
+
67
+ YARD::Tags::Tag.new(:param, "", yard_types, name.to_s)
68
+ end
69
+
59
70
  def build_return_tag(type, within_block: false)
60
71
  return unless type
61
72
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module YardSig
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-sig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takumi Shotoku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-08 00:00:00.000000000 Z
11
+ date: 2024-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs
@@ -63,8 +63,8 @@ licenses:
63
63
  - MIT
64
64
  metadata:
65
65
  homepage_uri: https://github.com/sinsoku/yard-sig
66
- source_code_uri: https://github.com/sinsoku/yard-sig/blob/v0.2.1/CHANGELOG.md
67
- changelog_uri: https://github.com/sinsoku/yard-sig/tree/v0.2.1
66
+ source_code_uri: https://github.com/sinsoku/yard-sig/blob/v0.2.2/CHANGELOG.md
67
+ changelog_uri: https://github.com/sinsoku/yard-sig/tree/v0.2.2
68
68
  post_install_message:
69
69
  rdoc_options: []
70
70
  require_paths:
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
- rubygems_version: 3.4.19
83
+ rubygems_version: 3.6.0.dev
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: A YARD plugin for writing documentations with RBS syntax