Class: Todidnt::GitCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/todidnt/git_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(command, options) ⇒ GitCommand

Returns a new instance of GitCommand.



3
4
5
6
# File 'lib/todidnt/git_command.rb', line 3

def initialize(command, options)
  @command = command
  @options = options
end

Instance Method Details

#command_with_optionsObject



16
17
18
19
20
21
22
23
24
# File 'lib/todidnt/git_command.rb', line 16

def command_with_options
  full_command = @command.to_s

  for option in @options
    full_command << " #{option.join(' ')}"
  end

  full_command
end

#output_linesObject



8
9
10
# File 'lib/todidnt/git_command.rb', line 8

def output_lines
  run!.strip.split(/\n/)
end

#run!Object



12
13
14
# File 'lib/todidnt/git_command.rb', line 12

def run!
  `git #{command_with_options}`
end