Class: MarkdownRubyDocumentation::TemplateParser::CommentMacros::MethodLink
- Inherits:
-
Object
- Object
- MarkdownRubyDocumentation::TemplateParser::CommentMacros::MethodLink
- Defined in:
- lib/markdown_ruby_documentation/template_parser.rb
Constant Summary collapse
- RUBY_METHOD_REGEX =
/(\b(?<!['"])[a-z_][a-z_0-9?!]*(?!['"]))/.freeze
Instance Method Summary collapse
-
#initialize(match:, call_on_title: :titleize, method_to_class: {}, link_to_markdown:, ruby_class:) ⇒ MethodLink
constructor
A new instance of MethodLink.
- #link ⇒ Object
Constructor Details
#initialize(match:, call_on_title: :titleize, method_to_class: {}, link_to_markdown:, ruby_class:) ⇒ MethodLink
Returns a new instance of MethodLink.
328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/markdown_ruby_documentation/template_parser.rb', line 328 def initialize(match:, call_on_title: :titleize, method_to_class: {}, link_to_markdown:, ruby_class:) @match = match @ruby_class = ruby_class @call_on_title = call_on_title @method_to_class = method_to_class @link_to_markdown = link_to_markdown end |
Instance Method Details
#link ⇒ Object
340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/markdown_ruby_documentation/template_parser.rb', line 340 def link if constant_override constant_override_method_path else link = link_to_markdown.call(method_name, title: title, _ruby_class: method_owner) if link == :non_project_location match else link end end rescue UnimplementedMethod => e "[#{title}](##{match.downcase.dasherize.delete(" ").delete('?').delete("!")})" end |