Class: MasterToMain::Repo
- Inherits:
-
Object
- Object
- MasterToMain::Repo
- Defined in:
- lib/master_to_main/repo.rb
Instance Attribute Summary collapse
-
#github ⇒ Object
Returns the value of attribute github.
-
#new_branch ⇒ Object
Returns the value of attribute new_branch.
-
#old_branch ⇒ Object
Returns the value of attribute old_branch.
-
#repo_name ⇒ Object
Returns the value of attribute repo_name.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #api_endpoint ⇒ Object
-
#initialize(github, user, repo_name, old_branch, new_branch) ⇒ Repo
constructor
A new instance of Repo.
- #name ⇒ Object
- #new_branch_replacement ⇒ Object
- #new_branch_url ⇒ Object
- #old_branch_regex ⇒ Object
- #public_github? ⇒ Boolean
Constructor Details
#initialize(github, user, repo_name, old_branch, new_branch) ⇒ Repo
Returns a new instance of Repo.
5 6 7 8 9 10 11 |
# File 'lib/master_to_main/repo.rb', line 5 def initialize(github, user, repo_name, old_branch, new_branch) @github = github @user = user @repo_name = repo_name @old_branch = old_branch @new_branch = new_branch end |
Instance Attribute Details
#github ⇒ Object
Returns the value of attribute github.
3 4 5 |
# File 'lib/master_to_main/repo.rb', line 3 def github @github end |
#new_branch ⇒ Object
Returns the value of attribute new_branch.
3 4 5 |
# File 'lib/master_to_main/repo.rb', line 3 def new_branch @new_branch end |
#old_branch ⇒ Object
Returns the value of attribute old_branch.
3 4 5 |
# File 'lib/master_to_main/repo.rb', line 3 def old_branch @old_branch end |
#repo_name ⇒ Object
Returns the value of attribute repo_name.
3 4 5 |
# File 'lib/master_to_main/repo.rb', line 3 def repo_name @repo_name end |
#user ⇒ Object
Returns the value of attribute user.
3 4 5 |
# File 'lib/master_to_main/repo.rb', line 3 def user @user end |
Instance Method Details
#api_endpoint ⇒ Object
13 14 15 |
# File 'lib/master_to_main/repo.rb', line 13 def api_endpoint "https://" + github + "/api/v3/" end |
#name ⇒ Object
17 18 19 |
# File 'lib/master_to_main/repo.rb', line 17 def name "#{user}/#{repo_name}" end |
#new_branch_replacement ⇒ Object
25 26 27 |
# File 'lib/master_to_main/repo.rb', line 25 def new_branch_replacement "\\1/\\2/#{new_branch}" end |
#new_branch_url ⇒ Object
29 30 31 |
# File 'lib/master_to_main/repo.rb', line 29 def new_branch_url "https://#{github}/#{name}/tree/#{new_branch}" end |
#old_branch_regex ⇒ Object
21 22 23 |
# File 'lib/master_to_main/repo.rb', line 21 def old_branch_regex "(http[s]?:\/\/#{github}\/#{user}\/#{repo_name}\)/(tree|blob)\/#{old_branch}" end |
#public_github? ⇒ Boolean
33 34 35 |
# File 'lib/master_to_main/repo.rb', line 33 def public_github? @github == "github.com" end |