Class: Todidnt::GitCommand
- Inherits:
-
Object
- Object
- Todidnt::GitCommand
- Defined in:
- lib/todidnt/git_command.rb
Instance Method Summary collapse
- #command_with_options ⇒ Object
- #execute!(&blk) ⇒ Object
-
#initialize(command, options) ⇒ GitCommand
constructor
A new instance of GitCommand.
Constructor Details
#initialize(command, options) ⇒ GitCommand
Returns a new instance of GitCommand.
5 6 7 8 9 10 |
# File 'lib/todidnt/git_command.rb', line 5 def initialize(command, ) @command = command = @process = Subprocess::Process.new(, :stdout => Subprocess::PIPE) end |
Instance Method Details
#command_with_options ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/todidnt/git_command.rb', line 18 def full_command = @command.to_s for option in full_command << " #{option.join(' ')}" end "git #{full_command}" end |
#execute!(&blk) ⇒ Object
12 13 14 15 16 |
# File 'lib/todidnt/git_command.rb', line 12 def execute!(&blk) @process.stdout.each_line do |line| yield line.chomp end end |