Class: Dk::Local::BaseCmd

Inherits:
Object
  • Object
show all
Defined in:
lib/dk/local.rb

Direct Known Subclasses

Cmd, CmdSpy

Defined Under Namespace

Classes: OutputLine

Instance Attribute Summary collapse

Instance Method Summary collapse

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_strObject (readonly)

Returns the value of attribute cmd_str.



8
9
10
# File 'lib/dk/local.rb', line 8

def cmd_str
  @cmd_str
end

#scmdObject (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_linesObject



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

#stderrObject



25
# File 'lib/dk/local.rb', line 25

def stderr;   @scmd.stderr;   end

#stdoutObject



24
# File 'lib/dk/local.rb', line 24

def stdout;   @scmd.stdout;   end

#success?Boolean

Returns:

  • (Boolean)


26
# File 'lib/dk/local.rb', line 26

def success?; @scmd.success?; end

#to_sObject



17
# File 'lib/dk/local.rb', line 17

def to_s; self.cmd_str; end