debian-mirror-gitlab/lib/gitlab/github_import/base_formatter.rb

25 lines
562 B
Ruby
Raw Normal View History

module Gitlab
module GithubImport
class BaseFormatter
2017-08-17 22:00:37 +05:30
attr_reader :client, :formatter, :project, :raw_data
2017-08-17 22:00:37 +05:30
def initialize(project, raw_data, client = nil)
@project = project
@raw_data = raw_data
2017-08-17 22:00:37 +05:30
@client = client
@formatter = Gitlab::ImportFormatter.new
end
def create!
2016-11-03 12:29:30 +05:30
project.public_send(project_association).find_or_create_by!(find_condition) do |record|
record.attributes = attributes
end
end
2017-08-17 22:00:37 +05:30
def url
raw_data.url || ''
2016-09-29 09:46:39 +05:30
end
end
end
end