Method: LearnLab::VCS#initialize

Defined in:
lib/learn_lab/vcs.rb

#initialize(directory, &block) ⇒ VCS

Returns a new instance of VCS.



7
8
9
10
11
12
13
14
# File 'lib/learn_lab/vcs.rb', line 7

def initialize(directory, &block)
  @repo = Git.open(directory)
rescue StandardError => e
  msg = "You don't appear to be in a Learn lesson's directory. Please " \
        'cd to an appropriate directory and try again.'

  block_given? ? block.call(msg, e) : raise(LearnLab::Error.new(msg))
end