Class: MarkdownRubyDocumentation::PrintMethodSource

Inherits:
Object
  • Object
show all
Defined in:
lib/markdown_ruby_documentation/template_parser/print_method_source.rb

Instance Method Summary collapse

Constructor Details

#initialize(method:) ⇒ PrintMethodSource

Returns a new instance of PrintMethodSource.



3
4
5
# File 'lib/markdown_ruby_documentation/template_parser/print_method_source.rb', line 3

def initialize(method:)
  @method_object = method
end

Instance Method Details



7
8
9
10
11
12
13
# File 'lib/markdown_ruby_documentation/template_parser/print_method_source.rb', line 7

def print
  method_object.to_proc
    .source
    .split("\n")[1..-2]
    .map(&:lstrip)
    .join("\n")
end