Class: Gitlab::GithubImport::PullRequestFormatter

Inherits:
BaseFormatter
  • Object
show all
Defined in:
lib/gitlab/github_import/pull_request_formatter.rb

Instance Attribute Summary

Attributes inherited from BaseFormatter

#formatter, #project, #raw_data

Instance Method Summary collapse

Methods inherited from BaseFormatter

#initialize

Constructor Details

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

Instance Method Details

#attributesObject


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gitlab/github_import/pull_request_formatter.rb', line 4

def attributes
  {
    iid: number,
    title: raw_data.title,
    description: description,
    source_project: source_project,
    source_branch: source_branch.name,
    target_project: target_project,
    target_branch: target_branch.name,
    state: state,
    milestone: milestone,
    author_id: author_id,
    assignee_id: assignee_id,
    created_at: raw_data.created_at,
    updated_at: updated_at
  }
end

#numberObject


22
23
24
# File 'lib/gitlab/github_import/pull_request_formatter.rb', line 22

def number
  raw_data.number
end

#valid?Boolean

Returns:

  • (Boolean)

26
27
28
# File 'lib/gitlab/github_import/pull_request_formatter.rb', line 26

def valid?
  !cross_project? && source_branch.present? && target_branch.present?
end