Class: TachikomaAi::Repository
- Inherits:
-
Object
- Object
- TachikomaAi::Repository
- Defined in:
- lib/tachikoma_ai/repository.rb
Instance Attribute Summary collapse
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #compare(start, endd) ⇒ Object
-
#initialize(url) ⇒ Repository
constructor
A new instance of Repository.
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
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
6 7 8 |
# File 'lib/tachikoma_ai/repository.rb', line 6 def owner @owner end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
6 7 8 |
# File 'lib/tachikoma_ai/repository.rb', line 6 def repo @repo end |
#url ⇒ Object (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 |