Module: LitaGithub::Repo
- Defined in:
- lib/lita-github/repo.rb
Overview
Github handler common-use Repository methods
Constant Summary collapse
- PR_LIST_MAX_COUNT =
Maximum number of allowed PRs to be returned when listing
20
Instance Method Summary collapse
-
#repo?(r) ⇒ Boolean
Determine if r is a Github repository.
-
#repo_has_team?(full_name, team_id) ⇒ TrueClass, FalseClass
Determine if the team is already on the repository.
-
#repo_match(md) ⇒ Array
Helper method for pulling widely used matches out of a MatchData object.
-
#rpo(org, repo) ⇒ String
Combine org and repo to get the canonical name.
Instance Method Details
#repo?(r) ⇒ Boolean
Determine if r is a Github repository
39 40 41 |
# File 'lib/lita-github/repo.rb', line 39 def repo?(r) octo.repository?(r) end |
#repo_has_team?(full_name, team_id) ⇒ TrueClass, FalseClass
Determine if the team is already on the repository
58 59 60 61 |
# File 'lib/lita-github/repo.rb', line 58 def repo_has_team?(full_name, team_id) octo.repository_teams(full_name).each { |t| return true if t[:id] == team_id } false end |
#repo_match(md) ⇒ Array
Helper method for pulling widely used matches out of a MatchData object
48 49 50 |
# File 'lib/lita-github/repo.rb', line 48 def repo_match(md) [organization(md['org']), md['repo']] end |
#rpo(org, repo) ⇒ String
Combine org and repo to get the canonical name
31 32 33 |
# File 'lib/lita-github/repo.rb', line 31 def rpo(org, repo) "#{org}/#{repo}" end |