module Rundoc

Constants

VERSION

Attributes

project_root[RW]

Public Instance Methods

after_build(&block) click to toggle source
# File lib/rundoc.rb, line 56
def after_build(&block)
  @after_build_block ||= []
  @after_build_block << block
end
code_command(keyword) click to toggle source
# File lib/rundoc.rb, line 35
def code_command(keyword)
  code_lookup[:"#{keyword}"]
end
code_command_from_keyword(keyword, args) click to toggle source
# File lib/rundoc.rb, line 8
def code_command_from_keyword(keyword, args)
  klass      = code_command(keyword.to_sym) || Rundoc::CodeCommand::NoSuchCommand
  original_args = args.dup
  if args.is_a?(Array) && args.last.is_a?(Hash)
    kwargs = args.pop
    cc = klass.new(*args, **kwargs)
  elsif args.is_a?(Hash)
    cc = klass.new(**args)
  else
    cc = klass.new(*args)
  end

  cc.original_args = original_args
  cc.keyword = keyword
  cc
rescue ArgumentError => e
  raise ArgumentError, "Wrong method signature for #{keyword} with arguments: #{original_args.inspect}, error:\n #{e.message}"
end
code_lookup() click to toggle source
# File lib/rundoc.rb, line 31
def code_lookup
  @code_lookup ||= {}
end
config() { |self| ... } click to toggle source
# File lib/rundoc.rb, line 61
def config
  yield self
end
configure() { |self| ... } click to toggle source
# File lib/rundoc.rb, line 47
def configure(&block)
  yield self
end
filter_sensitive(sensitive) click to toggle source
# File lib/rundoc.rb, line 69
def filter_sensitive(sensitive)
  raise "Expecting #{sensitive} to be a hash" unless sensitive.is_a?(Hash)
  @sensitive ||= {}
  @sensitive.merge!(sensitive)
end
known_commands() click to toggle source
# File lib/rundoc.rb, line 39
def known_commands
  code_lookup.keys
end
parser_options() click to toggle source
# File lib/rundoc.rb, line 27
def parser_options
  @parser_options ||= {}
end
register_code_command(keyword, klass) click to toggle source
# File lib/rundoc.rb, line 43
def register_code_command(keyword, klass)
  code_lookup[keyword] = klass
end
register_repl(*args, &block) click to toggle source
# File lib/rundoc.rb, line 65
def register_repl(*args, &block)
  ReplRunner.register_commands(*args, &block)
end
run_after_build() click to toggle source
# File lib/rundoc.rb, line 51
def run_after_build
  @after_build_block ||= []
  @after_build_block.each(&:call)
end
sanitize(doc) click to toggle source
# File lib/rundoc.rb, line 75
def sanitize(doc)
  return doc if @sensitive.nil?
  @sensitive.each do |sensitive, replace|
    doc.gsub!(sensitive.to_s, replace)
  end
  return doc
end