Class: GitPunch::Repository

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Repository

Returns a new instance of Repository.



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

def initialize options={}
  @path = options[:from]
  @user = if options[:user].nil?
    User.from_config
  else
    create_user_from options[:user]
  end
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/git_punch/repository.rb', line 5

def path
  @path
end

#userObject

Returns the value of attribute user.



5
6
7
# File 'lib/git_punch/repository.rb', line 5

def user
  @user
end

Class Method Details

.current!Object



20
21
22
# File 'lib/git_punch/repository.rb', line 20

def self.current!
  new from: ENV['PWD']
end

Instance Method Details

#nameObject



16
17
18
# File 'lib/git_punch/repository.rb', line 16

def name
  File.basename path
end