Class: Rundoc::CodeCommand::RundocCommandRunner
- Inherits:
-
Object
- Object
- Rundoc::CodeCommand::RundocCommandRunner
- Defined in:
- lib/rundoc/code_command/rundoc_command.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#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) ⇒ RundocCommandRunner
constructor
A new instance of RundocCommandRunner.
- #to_md(env = {}) ⇒ Object
Constructor Details
#initialize(user_args:, render_command:, render_result:, io:, contents: nil) ⇒ RundocCommandRunner
Returns a new instance of RundocCommandRunner.
16 17 18 19 20 |
# File 'lib/rundoc/code_command/rundoc_command.rb', line 16 def initialize(user_args:, render_command:, render_result:, io:, contents: nil) @io = io @contents = contents.dup if contents && !contents.empty? @contents = user_args.code + (@contents || +"") end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
14 15 16 |
# File 'lib/rundoc/code_command/rundoc_command.rb', line 14 def contents @contents end |
#io ⇒ Object (readonly)
Returns the value of attribute io.
14 15 16 |
# File 'lib/rundoc/code_command/rundoc_command.rb', line 14 def io @io end |
Instance Method Details
#call(env = {}) ⇒ Object
26 27 28 29 30 |
# File 'lib/rundoc/code_command/rundoc_command.rb', line 26 def call(env = {}) io.puts "Running: #{contents}" eval(contents) # rubocop:disable Security/Eval "" end |
#to_md(env = {}) ⇒ Object
22 23 24 |
# File 'lib/rundoc/code_command/rundoc_command.rb', line 22 def to_md(env = {}) "" end |