class MarkdownRubyDocumentation::TemplateParser::CommentMacros::MethodLink

Constants

RUBY_METHOD_REGEX

Attributes

call_on_title[R]
match[R]
method_to_class[R]
ruby_class[R]

Public Class Methods

new(match:, call_on_title: :titleize, method_to_class: {}, link_to_markdown:, ruby_class:) click to toggle source
# File lib/markdown_ruby_documentation/template_parser.rb, line 327
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

Public Instance Methods

Private Instance Methods

constant_override() click to toggle source
# File lib/markdown_ruby_documentation/template_parser.rb, line 367
def constant_override
  @constant_override ||= method_to_class[match.to_sym]
end
constant_override_method_path() click to toggle source
# File lib/markdown_ruby_documentation/template_parser.rb, line 379
def constant_override_method_path
  method_object = Method.create("##{match}", context: constant_override)
  link_to_markdown.call("#{method_object.context.name}##{method_object.name}", title: title)
end
method_name() click to toggle source
# File lib/markdown_ruby_documentation/template_parser.rb, line 371
def method_name
  "##{match}"
end
method_owner() click to toggle source
# File lib/markdown_ruby_documentation/template_parser.rb, line 375
def method_owner
  Method.create(method_name, context: ruby_class).to_proc.owner
end
title() click to toggle source
# File lib/markdown_ruby_documentation/template_parser.rb, line 358
def title
  @title ||= if call_on_title
               @call_on_title = [*call_on_title].compact
               match.public_send(call_on_title.first, *call_on_title[1..-1])
             else
               match
             end
end