Class: Gitlab::LegacyGithubImport::BranchFormatter

Inherits:
BaseFormatter
  • Object
show all
Defined in:
lib/gitlab/legacy_github_import/branch_formatter.rb

Instance Attribute Summary

Attributes inherited from BaseFormatter

#client, #formatter, #project, #raw_data

Instance Method Summary collapse

Methods inherited from BaseFormatter

#create!, #initialize, #url

Constructor Details

This class inherits a constructor from Gitlab::LegacyGithubImport::BaseFormatter

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)

8
9
10
# File 'lib/gitlab/legacy_github_import/branch_formatter.rb', line 8

def exists?
  branch_exists? && commit_exists?
end

#short_shaObject


20
21
22
# File 'lib/gitlab/legacy_github_import/branch_formatter.rb', line 20

def short_sha
  Commit.truncate_sha(sha)
end

#userObject


16
17
18
# File 'lib/gitlab/legacy_github_import/branch_formatter.rb', line 16

def user
  raw_data.user&. || 'unknown'
end

#valid?Boolean

Returns:

  • (Boolean)

12
13
14
# File 'lib/gitlab/legacy_github_import/branch_formatter.rb', line 12

def valid?
  sha.present? && ref.present?
end