Class: Polyamory::Command

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/polyamory/command.rb

Overview

Internal: Represents a single command to run.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cmd) {|_self| ... } ⇒ Command

Returns a new instance of Command.

Yields:

  • (_self)

Yield Parameters:



8
9
10
11
12
# File 'lib/polyamory/command.rb', line 8

def initialize cmd
  @args = Array(cmd)
  @env  = Hash.new
  yield self if block_given?
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



6
7
8
# File 'lib/polyamory/command.rb', line 6

def env
  @env
end

Instance Method Details

#to_execObject



17
18
19
# File 'lib/polyamory/command.rb', line 17

def to_exec
  @args.map {|a| a.to_s }
end

#to_sObject



21
22
23
# File 'lib/polyamory/command.rb', line 21

def to_s
  to_exec.join(' ')
end