Class: Docdown::CodeCommands::Bash
- Inherits:
-
Docdown::CodeCommand
- Object
- Docdown::CodeCommand
- Docdown::CodeCommands::Bash
- Defined in:
- lib/docdown/code_commands/bash.rb
Instance Attribute Summary
Attributes inherited from Docdown::CodeCommand
#command, #contents, #hidden, #keyword, #render_result
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(command) ⇒ Bash
constructor
A new instance of Bash.
- #to_md ⇒ Object
Methods inherited from Docdown::CodeCommand
Constructor Details
#initialize(command) ⇒ Bash
Returns a new instance of Bash.
4 5 6 7 |
# File 'lib/docdown/code_commands/bash.rb', line 4 def initialize(command) @command = command @contents = "" end |
Instance Method Details
#call ⇒ Object
9 10 11 12 |
# File 'lib/docdown/code_commands/bash.rb', line 9 def call puts "Executing: #{to_md.inspect}" `#{@command} #{contents} 2>&1` end |
#to_md ⇒ Object
14 15 16 |
# File 'lib/docdown/code_commands/bash.rb', line 14 def to_md "$ #{@command} #{contents}" end |