Class: YardJunk::Janitor::Resolver
- Inherits:
-
Object
- Object
- YardJunk::Janitor::Resolver
- Includes:
- YARD::Templates::Helpers::HtmlHelper
- Defined in:
- lib/yard-junk/janitor/resolver.rb
Overview
TODO: Tests
Constant Summary collapse
- MESSAGE_PATTERN =
'In file `%{file}\':%{line}: Cannot resolve link to %{name} from text: %{link}'
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(docstring, yard_options) ⇒ Resolver
constructor
A new instance of Resolver.
- #resolve ⇒ Object
Constructor Details
#initialize(docstring, yard_options) ⇒ Resolver
Returns a new instance of Resolver.
15 16 17 18 |
# File 'lib/yard-junk/janitor/resolver.rb', line 15 def initialize(docstring, ) @docstring = docstring @options = end |
Class Method Details
.resolve_all(yard_options) ⇒ Object
11 12 13 |
# File 'lib/yard-junk/janitor/resolver.rb', line 11 def self.resolve_all() YARD::Registry.all.map(&:base_docstring).each { |ds| new(ds, ).resolve } end |
Instance Method Details
#resolve ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/yard-junk/janitor/resolver.rb', line 20 def resolve markup_meth = "html_markup_#{.markup}" return unless respond_to?(markup_meth) send(markup_meth, @docstring) .gsub(%r{<(code|tt|pre)[^>]*>(.*?)</\1>}im, '') .scan(/{[^}]+}/).flatten .map(&CGI.method(:unescapeHTML)) .each(&method(:try_resolve)) end |