Class: Faf::Repo

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, options = {}) ⇒ Repo

Returns a new instance of Repo.



7
8
9
10
# File 'lib/faf/repo.rb', line 7

def initialize(url, options = {})
  @owner, @name = url.split('/', 2)
  @pushed_at = options[:pushed_at]
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/faf/repo.rb', line 4

def name
  @name
end

#ownerObject (readonly)

Returns the value of attribute owner.



3
4
5
# File 'lib/faf/repo.rb', line 3

def owner
  @owner
end

#pushed_atObject (readonly)

Returns the value of attribute pushed_at.



5
6
7
# File 'lib/faf/repo.rb', line 5

def pushed_at
  @pushed_at
end

Instance Method Details

#fork_countObject



16
17
18
# File 'lib/faf/repo.rb', line 16

def fork_count
  repository.fork_count
end

#forksObject



12
13
14
# File 'lib/faf/repo.rb', line 12

def forks
  @forks ||= Faf::Forks.new(self)
end

#repositoryObject



20
21
22
# File 'lib/faf/repo.rb', line 20

def repository
  data.repository
end

#to_sObject



28
29
30
# File 'lib/faf/repo.rb', line 28

def to_s
  "#{url} (#{pushed_at.ago_in_words})"
end

#urlObject



24
25
26
# File 'lib/faf/repo.rb', line 24

def url
  "https://github.com/#{owner}/#{name}"
end