Class: Xcode::Shell::Command
- Inherits:
-
Object
- Object
- Xcode::Shell::Command
- Defined in:
- lib/xcode/shell/command.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
Returns the value of attribute env.
Instance Method Summary collapse
- #<<(arg) ⇒ Object
- #==(obj) ⇒ Object
-
#execute(show_output = true, &block) ⇒ Object
:yield: output.
-
#initialize(cmd, environment = {}) ⇒ Command
constructor
A new instance of Command.
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(cmd, environment = {}) ⇒ Command
Returns a new instance of Command.
8 9 10 11 12 |
# File 'lib/xcode/shell/command.rb', line 8 def initialize(cmd, environment={}) @cmd = cmd @args = [] @env = environment end |
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
6 7 8 |
# File 'lib/xcode/shell/command.rb', line 6 def env @env end |
Instance Method Details
#<<(arg) ⇒ Object
14 15 16 |
# File 'lib/xcode/shell/command.rb', line 14 def <<(arg) @args << arg end |
#==(obj) ⇒ Object
30 31 32 33 34 |
# File 'lib/xcode/shell/command.rb', line 30 def ==(obj) return false unless obj.is_a? Xcode::Shell::Command # to_s==obj.to_s Set.new(obj.to_a) == Set.new(self.to_a) end |
#execute(show_output = true, &block) ⇒ Object
:yield: output
36 37 38 |
# File 'lib/xcode/shell/command.rb', line 36 def execute(show_output=true, &block) #:yield: output Xcode::Shell.execute(self, show_output, &block) end |
#to_a ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/xcode/shell/command.rb', line 22 def to_a out = [] out << @cmd out+=@args out+=(@env.map {|k,v| "#{k}=#{v}"}) out end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/xcode/shell/command.rb', line 18 def to_s "#{to_a.join(' ')}" end |