Class: Rundoc::CodeCommand::RundocCommand::DependOn

Inherits:
Rundoc::CodeCommand show all
Defined in:
lib/rundoc/code_command/rundoc/depend_on.rb

Constant Summary

Constants inherited from Rundoc::CodeCommand

NEWLINE

Instance Attribute Summary

Attributes inherited from Rundoc::CodeCommand

#command, #contents, #keyword, #original_args, #render_command, #render_result

Instance Method Summary collapse

Methods inherited from Rundoc::CodeCommand

#push

Constructor Details

#initialize(path) ⇒ DependOn

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



6
7
8
9
# File 'lib/rundoc/code_command/rundoc/depend_on.rb', line 6

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



15
16
17
18
19
20
21
22
23
# File 'lib/rundoc/code_command/rundoc/depend_on.rb', line 15

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?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/rundoc/code_command/rundoc/depend_on.rb', line 25

def hidden?
  true
end

#not_hidden?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/rundoc/code_command/rundoc/depend_on.rb', line 29

def not_hidden?
  !hidden?
end

#to_md(env = {}) ⇒ Object



11
12
13
# File 'lib/rundoc/code_command/rundoc/depend_on.rb', line 11

def to_md(env = {})
  ""
end