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.
267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/markdown_ruby_documentation/template_parser.rb', line 267 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
279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/markdown_ruby_documentation/template_parser.rb', line 279 def link if constant_override constant_override_method_path else link = link_to_markdown.call(method_path, title: title) if link == :non_project_location match else link end end rescue UnimplementedMethod => e "[#{title}](##{match.downcase.dasherize.delete(" ").delete('?')})" end |