Class: Rundoc::CodeCommand::RundocCommand::RequireRunner
- Inherits:
-
Object
- Object
- Rundoc::CodeCommand::RundocCommand::RequireRunner
- Defined in:
- lib/rundoc/code_command/rundoc/require.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
- #call(env = {}) ⇒ Object
-
#initialize(user_args:, render_command:, render_result:, io:, contents: nil) ⇒ RequireRunner
constructor
A new instance of RequireRunner.
- #render_result? ⇒ Boolean
- #to_md(env = {}) ⇒ Object
Constructor Details
#initialize(user_args:, render_command:, render_result:, io:, contents: nil) ⇒ RequireRunner
Returns a new instance of RequireRunner.
17 18 19 20 21 |
# File 'lib/rundoc/code_command/rundoc/require.rb', line 17 def initialize(user_args:, render_command:, render_result:, io:, contents: nil) @path = user_args.path @io = io @render_result = render_result end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
15 16 17 |
# File 'lib/rundoc/code_command/rundoc/require.rb', line 15 def io @io end |
Instance Method Details
#call(env = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rundoc/code_command/rundoc/require.rb', line 31 def call(env = {}) execution_context = env[:context] document_path = @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 ), io: io ).to_md if render_result? io.puts "rundoc.require: Done executing #{@path.to_s.inspect}, putting contents into document" env[:before] << output else io.puts "rundoc.require: Done executing #{@path.to_s.inspect}, quietly" end "" end |
#render_result? ⇒ Boolean
23 24 25 |
# File 'lib/rundoc/code_command/rundoc/require.rb', line 23 def render_result? @render_result end |
#to_md(env = {}) ⇒ Object
27 28 29 |
# File 'lib/rundoc/code_command/rundoc/require.rb', line 27 def to_md(env = {}) "" end |