diff options
Diffstat (limited to 'lib/github/representation/branch.rb')
-rw-r--r-- | lib/github/representation/branch.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/github/representation/branch.rb b/lib/github/representation/branch.rb index 25b42994ab7..0087a3d3c4f 100644 --- a/lib/github/representation/branch.rb +++ b/lib/github/representation/branch.rb @@ -7,10 +7,14 @@ module Github raw.dig('user', 'login') || 'unknown' end + def repo? + raw['repo'].present? + end + def repo - return @repo if defined?(@repo) + return unless repo? - @repo = Github::Representation::Repo.new(raw['repo']) if raw['repo'].present? + @repo ||= Github::Representation::Repo.new(raw['repo']) end def ref @@ -25,12 +29,6 @@ module Github Commit.truncate_sha(sha) end - def exists? - return @exists if defined?(@exists) - - @exists = repository.branch_exists?(ref) - end - def valid? sha.present? && ref.present? end |