Class: Rundoc::CodeCommand::RundocCommand::Require
Instance Attribute Summary
#command, #contents, #keyword, #original_args, #render_command, #render_result
Instance Method Summary
collapse
#push
Constructor Details
#initialize(path) ⇒ Require
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
8
9
10
11
|
# File 'lib/rundoc/code_command/rundoc/require.rb', line 8
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
|
Instance Method Details
#call(env = {}) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/rundoc/code_command/rundoc/require.rb', line 17
def call(env = {})
env[:replace] ||= String.new
current_path = Pathname.new(env[:document_path]).dirname
document_path = @path.expand_path(current_path)
puts "rundoc.require: Start executing #{@path.to_s.inspect}"
output = Rundoc::Parser.new(document_path.read, document_path: document_path.to_s).to_md
puts "rundoc.require: Done executing #{@path.to_s.inspect}, putting contents into document"
env[:replace] << output
return ""
end
|
#hidden? ⇒ Boolean
30
31
32
|
# File 'lib/rundoc/code_command/rundoc/require.rb', line 30
def hidden?
true
end
|
#not_hidden? ⇒ Boolean
34
35
36
|
# File 'lib/rundoc/code_command/rundoc/require.rb', line 34
def not_hidden?
!hidden?
end
|
#to_md(env = {}) ⇒ Object
13
14
15
|
# File 'lib/rundoc/code_command/rundoc/require.rb', line 13
def to_md(env = {})
""
end
|