Method: Ed#initialize

Defined in:
lib/ed.rb

#initialize(path) {|_self| ... } ⇒ Ed

Parameters:

  • path (String)

    The path to a git repository.

  • &block (Proc)

    Executed in the scope of Delegator.

Yield Parameters:

  • _self (Ed)

    Yields self in the calling scope, if a block parameter is given.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/ed.rb', line 43

def initialize path, &block
  if Ed::Repository.remote?(path) || Ed::Config.copy_repository?
    @repo = Ed::RepositoryCopy.new(path)
  else
    @repo = Ed::Repository.new(path)
  end

  if block_given?
    if block.arity == 1
      yield self
    else
      delegator = Ed::Delegator.new(self)
      delegator.instance_eval(&block)
    end
  end
end