class MarkdownRubyDocumentation::TemplateParser

Constants

IGNORE_METHODS

Attributes

current_method[R]
erb_methods_class[R]
load_path[R]
methods[R]
output_object[R]
ruby_class[R]

Public Class Methods

new(ruby_class, methods) click to toggle source
# File lib/markdown_ruby_documentation/template_parser.rb, line 4
def initialize(ruby_class, methods)
  @ruby_class        = ruby_class
  @methods           = methods.map { |method| method.is_a?(Symbol) ? InstanceMethod.new("##{method}", context: ruby_class) : method }
  @erb_methods_class = erb_methods_class
end

Public Instance Methods

call(*args)
Alias for: to_hash
to_hash(*args) click to toggle source
# File lib/markdown_ruby_documentation/template_parser.rb, line 10
def to_hash(*args)
  parser
end
Also aliased as: call

Private Instance Methods

parser() click to toggle source
# File lib/markdown_ruby_documentation/template_parser.rb, line 49
def parser
  @parser ||= methods.each_with_object({}) do |method, hash|
    begin
      @current_method = method
      value           = compile_comment(method)
    rescue MethodSource::SourceNotFoundError
      @current_method = nil
      value           = false
    end
    hash[method.name] = { text: value, method_object: method } if value
  end
end