summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-06-06 14:00:44 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-06-06 14:26:28 -0300
commit67c02edccf2dc3d42126dcf4269862c2a1622fff (patch)
tree45aa9b5823ba4bf8ed00ed37f4b1b5e1a7e5a0a2 /lib
parent9437b8a2e4ae4c688272d0febfbca4007232e4f5 (diff)
downloadgitlab-ce-67c02edccf2dc3d42126dcf4269862c2a1622fff.tar.gz
Move create! method from formatters to the BaseFormatter
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/github_import/base_formatter.rb4
-rw-r--r--lib/gitlab/github_import/issue_formatter.rb8
-rw-r--r--lib/gitlab/github_import/label_formatter.rb4
-rw-r--r--lib/gitlab/github_import/milestone_formatter.rb4
-rw-r--r--lib/gitlab/github_import/pull_request_formatter.rb4
5 files changed, 14 insertions, 10 deletions
diff --git a/lib/gitlab/github_import/base_formatter.rb b/lib/gitlab/github_import/base_formatter.rb
index 202263c6742..72992baffd4 100644
--- a/lib/gitlab/github_import/base_formatter.rb
+++ b/lib/gitlab/github_import/base_formatter.rb
@@ -9,6 +9,10 @@ module Gitlab
@formatter = Gitlab::ImportFormatter.new
end
+ def create!
+ self.klass.create!(self.attributes)
+ end
+
private
def gl_user_id(github_id)
diff --git a/lib/gitlab/github_import/issue_formatter.rb b/lib/gitlab/github_import/issue_formatter.rb
index 47f625efb3a..835ec858b35 100644
--- a/lib/gitlab/github_import/issue_formatter.rb
+++ b/lib/gitlab/github_import/issue_formatter.rb
@@ -16,14 +16,14 @@ module Gitlab
}
end
- def create!
- Issue.create!(self.attributes)
- end
-
def has_comments?
raw_data.comments > 0
end
+ def klass
+ Issue
+ end
+
def number
raw_data.number
end
diff --git a/lib/gitlab/github_import/label_formatter.rb b/lib/gitlab/github_import/label_formatter.rb
index 87b51a0a178..9f18244e7d7 100644
--- a/lib/gitlab/github_import/label_formatter.rb
+++ b/lib/gitlab/github_import/label_formatter.rb
@@ -9,8 +9,8 @@ module Gitlab
}
end
- def create!
- Label.create!(self.attributes)
+ def klass
+ Label
end
private
diff --git a/lib/gitlab/github_import/milestone_formatter.rb b/lib/gitlab/github_import/milestone_formatter.rb
index a0d2e47c412..53d4b3102d1 100644
--- a/lib/gitlab/github_import/milestone_formatter.rb
+++ b/lib/gitlab/github_import/milestone_formatter.rb
@@ -14,8 +14,8 @@ module Gitlab
}
end
- def create!
- Milestone.create!(self.attributes)
+ def klass
+ Milestone
end
private
diff --git a/lib/gitlab/github_import/pull_request_formatter.rb b/lib/gitlab/github_import/pull_request_formatter.rb
index 0d21c49035e..498b00cb658 100644
--- a/lib/gitlab/github_import/pull_request_formatter.rb
+++ b/lib/gitlab/github_import/pull_request_formatter.rb
@@ -24,8 +24,8 @@ module Gitlab
}
end
- def create!
- MergeRequest.create!(self.attributes)
+ def klass
+ MergeRequest
end
def number