Skip to content

Commit 23c3e5c

Browse files
committed
Review fixes
- Move the parser to definition to `discover.rb` - Move the rdoc plugin files to rdoc_plugin directory - Rename files - Rewrite signatures for the above changes
1 parent 7058f60 commit 23c3e5c

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

lib/rdoc/discover.rb

Lines changed: 0 additions & 8 deletions
This file was deleted.

lib/rdoc_plugin/discover.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
begin
2+
gem 'rdoc', '~> 6.4.0'
3+
require 'rdoc_plugin/parser'
4+
module RDoc
5+
class Parser
6+
class RBS < Parser
7+
parse_files_matching(/\.rbs$/)
8+
def scan
9+
::RBS::RDocPlugin::Parser.new(@top_level, @content).scan
10+
end
11+
end
12+
end
13+
end
14+
rescue Gem::LoadError
15+
# Error :sad:
16+
rescue Exception
17+
# Exception :sad:
18+
end

lib/rdoc/parser/rbs.rb renamed to lib/rdoc_plugin/parser.rb

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,11 @@
22

33
require 'rbs'
44

5-
module RDoc
6-
class Parser
7-
class RBS < Parser
8-
parse_files_matching(/\.rbs$/)
9-
10-
def scan
11-
::RBS::RDocPlugin::Parser.new(@top_level, @content).scan
12-
end
13-
end
14-
end
15-
end
16-
175
module RBS
186
module RDocPlugin
197
class Parser
208

21-
attr_reader :top_level, :content
9+
attr_accessor :top_level, :content
2210

2311
def initialize(top_level, content)
2412
@top_level = top_level

sig/rdoc/rbs.rbs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
module RDoc
2+
class Parser
3+
class RBS < Parser
4+
end
5+
end
6+
end
7+
18
module RBS
29
module RDocPlugin
310
class Parser

stdlib/rdoc/0/rdoc.rbs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ module RDoc
109109
def initialize: (RDoc::TopLevel top_level, String filename, String content, Hash[untyped, untyped] options, RDoc::Stats stats) -> void
110110

111111
def scan: () -> RDoc::TopLevel
112-
113-
class RBS < Parser
114-
end
115112
end
116113

117114
# <!-- rdoc-file=lib/rdoc/code_object.rb -->

test/rbs/rdoc/rbs_parser_test.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
require "test_helper"
22

3-
require "tempfile"
3+
require "rdoc_plugin/parser"
44

5-
require "rdoc/parser/rbs"
6-
7-
class RBSParserTest < Test::Unit::TestCase
5+
class RDocPluginParserTest < Test::Unit::TestCase
86
def parser(content)
97
top_level = RDoc::TopLevel.new("a.rbs")
108
top_level.store = RDoc::Store.new()

0 commit comments

Comments
 (0)