yard-rustdoc 0.1.0 → 0.2.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: 79bdb3aec8e1f714e0171aa730ac8f7ae76a2c03a833469e881c509965b2e570
4
- data.tar.gz: 3b9c82a3687ac3dd58f94932e63f1a71ef390314f7a1940dd2b1f2618aec8845
3
+ metadata.gz: b9e27bb76802a3dcf98f4c78e30ed98251aed81e4927e464f2da5989768d0328
4
+ data.tar.gz: 8a96e1280b7bca47976e4d2b74da7a1be05f34428f6d6c1f65528079f2532e49
5
5
  SHA512:
6
- metadata.gz: eff3df27844e46ad1ff348af7149e7e87758249f0478afbd88b68692ba84338a9b1a970091b14f703491b6cf78738ebb61b16dc3eae2bc8c49c450ea9f1a2d7d
7
- data.tar.gz: be52e56f4bb91b3047b57b8fd1518b9c094e74b0601fdc32349c3e425beac0a6914589997955a9fc37f2a0673c35336cf77dd77b269284578d53092d4f7d26a2
6
+ metadata.gz: 765bf4cc6f745a9f4d91cbf6eaf17dbf5db45567979bf009d72c684ce6b0e67e6c22ffb2f0f2003b14ce75fef31dd7f4080f36af265d0aa45113d3d141af2689
7
+ data.tar.gz: 89d3d49913d6ae12be8819472a7536a76b92074cf75828f84571d8125b45049b18ac41fe3cb8553c5e70851b183fdd2de6c083b0626fccfa304bc34f74ba5962
data/README.md CHANGED
@@ -1,16 +1,15 @@
1
1
  # YARD::Rustdoc
2
2
 
3
3
  YARD plugin for documenting Magnus-based Rust gems. Supports writing class
4
- documentation on Struct and method documentation on Struct methods.
5
-
6
- **Note**: WIP, not released.
4
+ documentation on Struct and Enums, and method documentation on Struct and Enum
5
+ methods.
7
6
 
8
7
  ## Installation
9
8
 
10
9
  Add this line to your application's Gemfile:
11
10
 
12
11
  ```ruby
13
- gem 'yard-rustdoc'
12
+ gem "yard-rustdoc"
14
13
  ```
15
14
 
16
15
  Load the plugin through `--plugin rustdoc` (e.g. in your project's `.yardopts`).
@@ -73,12 +72,16 @@ impl Bar {
73
72
  }
74
73
  ```
75
74
 
76
- Defines `Foo::Bar#baz`:
75
+ Defines `Foo::Bar#baz` and `#qux` -- instance method because the method's first
76
+ argument is either `&self` or `rb_self`.
77
77
 
78
78
  ```rust
79
79
  impl Bar {
80
80
  /// @yard
81
81
  fn baz(&self) {}
82
+
83
+ /// @yard
84
+ fn qux(rb_self: Value) {}
82
85
  }
83
86
  ```
84
87
 
@@ -111,6 +114,7 @@ YARD's syntax differs from what Rustdoc expects. Linters you man want to disable
111
114
  ```rust
112
115
  #![allow(rustdoc::broken_intra_doc_links)]
113
116
  #![allow(rustdoc::invalid_html_tags)]
117
+ #![allow(rustdoc::bare_urls)]
114
118
  ```
115
119
 
116
120
  ## Development
@@ -2,6 +2,8 @@
2
2
 
3
3
  module YARD::Parser::Rustdoc
4
4
  class Parser < YARD::Parser::Base
5
+ TOP_LEVEL_KINDS = ["struct", "enum"].freeze
6
+
5
7
  # This default constructor does nothing. The subclass is responsible for
6
8
  # storing the source contents and filename if they are required.
7
9
  # @param [String] source the source contents
@@ -28,7 +30,7 @@ module YARD::Parser::Rustdoc
28
30
 
29
31
  @rustdoc_json.each do |id, entry|
30
32
  next unless relevant_entry?(entry)
31
- next unless entry["kind"] == "struct"
33
+ next unless TOP_LEVEL_KINDS.include?(entry["kind"])
32
34
 
33
35
  methods = entry
34
36
  .dig("inner", "impls")
@@ -90,7 +90,7 @@ module YARD::Parser::Rustdoc
90
90
 
91
91
  def scope
92
92
  first_arg = @rustdoc.dig("inner", "decl", "inputs", 0, 0)
93
- if first_arg == "self"
93
+ if first_arg == "self" || first_arg == "rb_self"
94
94
  :instance
95
95
  else
96
96
  :class
@@ -2,6 +2,6 @@
2
2
 
3
3
  module YARD
4
4
  module Rustdoc
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-rustdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Bourassa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-25 00:00:00.000000000 Z
11
+ date: 2022-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
- rubygems_version: 3.3.7
118
+ rubygems_version: 3.3.24
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Generate YARD documentation for Magnus-based Rust gems.