class Rundoc::CodeCommand::RundocCommand::Require
Public Class Methods
Source
# File lib/rundoc/code_command/rundoc/require.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
Pass in the relative path of another rundoc document in order to run all of it’s commands. Resulting contents will be displayed in current document
Public Instance Methods
Source
# File lib/rundoc/code_command/rundoc/require.rb, line 16 def call(env = {}) execution_context = env[:context] document_path = @path.expand_path(execution_context.source_dir) output = Rundoc::Document.new( document_path.read, context: Rundoc::Context::Execution.new( source_path: document_path, output_dir: execution_context.output_dir, screenshots_dirname: execution_context.screenshots_dir, with_contents_dir: execution_context.with_contents_dir ) ).to_md if render_result? puts "rundoc.require: Done executing #{@path.to_s.inspect}, putting contents into document" env[:before] << output else puts "rundoc.require: Done executing #{@path.to_s.inspect}, quietly" end "" end
Source
# File lib/rundoc/code_command/rundoc/require.rb, line 12 def to_md(env = {}) "" end