Module: DTAS::Command

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

Overview

common code for wrapping SoX/ecasound/… commands

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.


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

def command
  @command
end

#envObject

Returns the value of attribute env.


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

def env
  @env
end

#pidObject (readonly)

Returns the value of attribute pid.


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

def pid
  @pid
end

#spawn_atObject

Returns the value of attribute spawn_at.


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

def spawn_at
  @spawn_at
end

#to_ioObject (readonly)

Returns the value of attribute to_io.


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

def to_io
  @to_io
end

Instance Method Details

#command_init(defaults = {}) ⇒ Object


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

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


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

def command_string
  @command
end

#on_death(status) ⇒ Object


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

def on_death(status)
  @pid = nil
end