Module: DTAS::Command

Includes:
Serialize
Included in:
Sink, Source::Cmd, Source::File
Defined in:
lib/dtas/command.rb

Overview

:nodoc:

Constant Summary collapse

COMMAND_DEFAULTS =
{
  "env" => {},
  "command" => nil,
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Serialize

#ivars_to_hash

Instance Attribute Details

#commandObject

Returns the value of attribute command.



11
12
13
# File 'lib/dtas/command.rb', line 11

def command
  @command
end

#envObject

Returns the value of attribute env.



12
13
14
# File 'lib/dtas/command.rb', line 12

def env
  @env
end

#pidObject (readonly)

Returns the value of attribute pid.



9
10
11
# File 'lib/dtas/command.rb', line 9

def pid
  @pid
end

#spawn_atObject

Returns the value of attribute spawn_at.



13
14
15
# File 'lib/dtas/command.rb', line 13

def spawn_at
  @spawn_at
end

#to_ioObject (readonly)

Returns the value of attribute to_io.



10
11
12
# File 'lib/dtas/command.rb', line 10

def to_io
  @to_io
end

Instance Method Details

#command_init(defaults = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/dtas/command.rb', line 20

def command_init(defaults = {})
  @pid = nil
  @to_io = nil
  @spawn_at = nil
  COMMAND_DEFAULTS.merge(defaults).each do |k,v|
    v = v.dup if Hash === v || Array === v
    instance_variable_set("@#{k}", v)
  end
end

#command_stringObject



34
35
36
# File 'lib/dtas/command.rb', line 34

def command_string
  @command
end

#on_death(status) ⇒ Object



30
31
32
# File 'lib/dtas/command.rb', line 30

def on_death(status)
  @pid = nil
end