Class: Dk::Local::BaseCmd
- Inherits:
-
Object
- Object
- Dk::Local::BaseCmd
- Defined in:
- lib/dk/local.rb
Defined Under Namespace
Classes: OutputLine
Instance Attribute Summary collapse
-
#cmd_str ⇒ Object
readonly
Returns the value of attribute cmd_str.
-
#scmd ⇒ Object
readonly
Returns the value of attribute scmd.
Instance Method Summary collapse
-
#initialize(scmd_or_spy_klass, cmd_str, opts) ⇒ BaseCmd
constructor
A new instance of BaseCmd.
- #output_lines ⇒ Object
- #run(input = nil) ⇒ Object
- #stderr ⇒ Object
- #stdout ⇒ Object
- #success? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(scmd_or_spy_klass, cmd_str, opts) ⇒ BaseCmd
Returns a new instance of BaseCmd.
10 11 12 13 14 15 |
# File 'lib/dk/local.rb', line 10 def initialize(scmd_or_spy_klass, cmd_str, opts) opts ||= {} @cmd_str = cmd_str @scmd = scmd_or_spy_klass.new(@cmd_str, :env => opts[:env]) end |
Instance Attribute Details
#cmd_str ⇒ Object (readonly)
Returns the value of attribute cmd_str.
8 9 10 |
# File 'lib/dk/local.rb', line 8 def cmd_str @cmd_str end |
#scmd ⇒ Object (readonly)
Returns the value of attribute scmd.
8 9 10 |
# File 'lib/dk/local.rb', line 8 def scmd @scmd end |
Instance Method Details
#output_lines ⇒ Object
28 29 30 |
# File 'lib/dk/local.rb', line 28 def output_lines build_stdout_lines(self.stdout) + build_stderr_lines(self.stderr) end |
#run(input = nil) ⇒ Object
19 20 21 22 |
# File 'lib/dk/local.rb', line 19 def run(input = nil) @scmd.run(input) self end |
#stderr ⇒ Object
25 |
# File 'lib/dk/local.rb', line 25 def stderr; @scmd.stderr; end |
#stdout ⇒ Object
24 |
# File 'lib/dk/local.rb', line 24 def stdout; @scmd.stdout; end |
#success? ⇒ Boolean
26 |
# File 'lib/dk/local.rb', line 26 def success?; @scmd.success?; end |
#to_s ⇒ Object
17 |
# File 'lib/dk/local.rb', line 17 def to_s; self.cmd_str; end |