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)


18
19
20
# File 'lib/gitlab/legacy_github_import/branch_formatter.rb', line 18

def exists?
  branch_exists? && commit_exists?
end

#refObject



14
15
16
# File 'lib/gitlab/legacy_github_import/branch_formatter.rb', line 14

def ref
  raw_data[:ref]
end

#repoObject



6
7
8
# File 'lib/gitlab/legacy_github_import/branch_formatter.rb', line 6

def repo
  raw_data[:repo]
end

#shaObject



10
11
12
# File 'lib/gitlab/legacy_github_import/branch_formatter.rb', line 10

def sha
  raw_data[:sha]
end

#short_shaObject



30
31
32
# File 'lib/gitlab/legacy_github_import/branch_formatter.rb', line 30

def short_sha
  Commit.truncate_sha(sha)
end

#userObject



26
27
28
# File 'lib/gitlab/legacy_github_import/branch_formatter.rb', line 26

def user
  raw_data.dig(:user, :login) || 'unknown'
end

#valid?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/gitlab/legacy_github_import/branch_formatter.rb', line 22

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