Class: FlakyTestTracker::Source::GitHubSource
- Inherits:
-
Object
- Object
- FlakyTestTracker::Source::GitHubSource
- Defined in:
- lib/flaky_test_tracker/source/github_source.rb
Overview
GitHub source.
Constant Summary collapse
- DEFAULT_HOST =
"github.com"
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#commit ⇒ Object
readonly
Returns the value of attribute commit.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Class Method Summary collapse
Instance Method Summary collapse
-
#file_source_location_uri(file_path:, line_number:) ⇒ URI
URI for a file on the source.
-
#initialize(repository:, commit:, branch:, host:) ⇒ GitHubSource
constructor
A new instance of GitHubSource.
-
#source_uri ⇒ URI
On the source.
Constructor Details
#initialize(repository:, commit:, branch:, host:) ⇒ GitHubSource
Returns a new instance of GitHubSource.
27 28 29 30 31 32 |
# File 'lib/flaky_test_tracker/source/github_source.rb', line 27 def initialize(repository:, commit:, branch:, host:) @host = host @repository = repository @commit = commit @branch = branch end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
25 26 27 |
# File 'lib/flaky_test_tracker/source/github_source.rb', line 25 def branch @branch end |
#commit ⇒ Object (readonly)
Returns the value of attribute commit.
25 26 27 |
# File 'lib/flaky_test_tracker/source/github_source.rb', line 25 def commit @commit end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
25 26 27 |
# File 'lib/flaky_test_tracker/source/github_source.rb', line 25 def host @host end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
25 26 27 |
# File 'lib/flaky_test_tracker/source/github_source.rb', line 25 def repository @repository end |
Class Method Details
.build(repository:, commit:, branch:, host: DEFAULT_HOST) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/flaky_test_tracker/source/github_source.rb', line 11 def self.build( repository:, commit:, branch:, host: DEFAULT_HOST ) new( host: host, repository: repository, commit: commit, branch: branch ) end |
Instance Method Details
#file_source_location_uri(file_path:, line_number:) ⇒ URI
Returns URI for a file on the source.
35 36 37 38 39 |
# File 'lib/flaky_test_tracker/source/github_source.rb', line 35 def file_source_location_uri(file_path:, line_number:) uri = URI("https://#{host}/#{repository}/blob/#{commit}/#{file_path}") uri.fragment = "L#{line_number}" uri end |
#source_uri ⇒ URI
Returns on the source.
42 43 44 |
# File 'lib/flaky_test_tracker/source/github_source.rb', line 42 def source_uri URI("https://#{host}/#{repository}/tree/#{commit}") end |