Class: Bucketface::Repository

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo) ⇒ Repository

Returns a new instance of Repository.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bucketface/repository.rb', line 5

def initialize(repo)
  case repo
  when String
    repo = repo.split("/")
    @name = repo.pop
    @username = repo.pop
  when Repository
    @username = repo.username
    @name = repo.name
  when Hash
    @name = repo[:repo] ||= repo[:name]
    @username = repo[:username] ||= repo[:user] 
  end
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/bucketface/repository.rb', line 3

def name
  @name
end

#usernameObject

Returns the value of attribute username.



3
4
5
# File 'lib/bucketface/repository.rb', line 3

def username
  @username
end

Instance Method Details

#to_sObject



24
25
26
# File 'lib/bucketface/repository.rb', line 24

def to_s
  @name
end

#userObject



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

def user
  @username
end