Class: CloneGitFile::Cloner

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

Instance Method Summary collapse

Constructor Details

#initialize(file, options = {}) ⇒ Cloner

Returns a new instance of Cloner.



6
7
8
9
# File 'lib/clone_git_file.rb', line 6

def initialize(file, options = {})
  @file = file.gsub("%20", " ")
  @options = options
end

Instance Method Details

#open_fileObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/clone_git_file.rb', line 11

def open_file
  if Dir.exists?(File.expand_path(local_repo_path))
    update_repo
  else
    clone_repo
  end

  if @options[:open_in_editor] ||
      @options[:output_run_command_to_terminal]
    launch_editor
  else
    print_clone_location
  end
end