Class: Polyamory::Command
- Inherits:
-
Object
- Object
- Polyamory::Command
- Extended by:
- Forwardable
- Defined in:
- lib/polyamory/command.rb
Overview
Internal: Represents a single command to run.
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
-
#initialize(cmd) {|_self| ... } ⇒ Command
constructor
A new instance of Command.
- #to_exec ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(cmd) {|_self| ... } ⇒ Command
Returns a new instance of Command.
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
#env ⇒ Object (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_exec ⇒ Object
17 18 19 |
# File 'lib/polyamory/command.rb', line 17 def to_exec @args.map {|a| a.to_s } end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/polyamory/command.rb', line 21 def to_s to_exec.join(' ') end |