Class: TachikomaAi::Repository

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Repository

Returns a new instance of Repository.



8
9
10
11
# File 'lib/tachikoma_ai/repository.rb', line 8

def initialize(url)
  @url = url.gsub(/http:/, 'https:')
  @owner, @repo = URI.parse(@url).path.split('/').drop(1)
end

Instance Attribute Details

#ownerObject (readonly)

Returns the value of attribute owner.



6
7
8
# File 'lib/tachikoma_ai/repository.rb', line 6

def owner
  @owner
end

#repoObject (readonly)

Returns the value of attribute repo.



6
7
8
# File 'lib/tachikoma_ai/repository.rb', line 6

def repo
  @repo
end

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/tachikoma_ai/repository.rb', line 6

def url
  @url
end

Instance Method Details

#compare(start, endd) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tachikoma_ai/repository.rb', line 13

def compare(start, endd)
  s = find_tag(start)
  e = find_tag(endd)
  base = "https://github.com/#{owner}/#{repo}"
  if s.nil? && e.nil?
    "#{base} (tags not found)"
  elsif e.nil?
    "#{base}/compare/#{s}...master"
  else
    "#{base}/compare/#{s}...#{e}"
  end
end