Class: Docdown::CodeCommands::Bash

Inherits:
Docdown::CodeCommand show all
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

Methods inherited from Docdown::CodeCommand

#push, #render

Constructor Details

#initialize(command) ⇒ Bash



4
5
6
7
# File 'lib/docdown/code_commands/bash.rb', line 4

def initialize(command)
  @command     = command
  @contents = ""
end

Instance Method Details

#callObject



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_mdObject



14
15
16
# File 'lib/docdown/code_commands/bash.rb', line 14

def to_md
  "$ #{@command} #{contents}"
end