class Rundoc::CodeCommand::RundocCommand::DependOn

Public Class Methods

new(path) click to toggle source

Pass in the relative path of another rundoc document in order to run all of it's commands (but not to )

# File lib/rundoc/code_command/rundoc/depend_on.rb, line 7
def initialize(path)
  raise "Path must be relative (i.e. start with `.` or `..`. #{path.inspect} does not" unless path.start_with?(".")
  @path = Pathname.new(path)
end

Public Instance Methods

call(env = {}) click to toggle source
# File lib/rundoc/code_command/rundoc/depend_on.rb, line 16
def call(env = {})
  current_path = Pathname.new(env[:document_path]).dirname
  document_path = @path.expand_path(current_path)
  # Run the commands, but do not
  puts "rundoc.depend_on: Start executing #{@path.to_s.inspect}"
  output = Rundoc::Parser.new(document_path.read, document_path: document_path.to_s).to_md
  puts "rundoc.depend_on: Done executing #{@path.to_s.inspect}, discarding intermediate document"
  output
end
hidden?() click to toggle source
# File lib/rundoc/code_command/rundoc/depend_on.rb, line 26
def hidden?
  true
end
not_hidden?() click to toggle source
# File lib/rundoc/code_command/rundoc/depend_on.rb, line 30
def not_hidden?
  !hidden?
end
to_md(env = {}) click to toggle source
# File lib/rundoc/code_command/rundoc/depend_on.rb, line 12
def to_md(env = {})
  ""
end