2020-10-23 11:08:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module BulkImports
|
|
|
|
module Pipeline
|
|
|
|
class Context
|
2021-02-15 16:08:59 -05:00
|
|
|
attr_accessor :extra
|
2020-10-23 11:08:42 -04:00
|
|
|
|
2021-03-18 11:09:04 -04:00
|
|
|
attr_reader :tracker
|
|
|
|
|
|
|
|
def initialize(tracker, extra = {})
|
|
|
|
@tracker = tracker
|
2021-02-15 16:08:59 -05:00
|
|
|
@extra = extra
|
2020-10-23 11:08:42 -04:00
|
|
|
end
|
|
|
|
|
2021-03-18 11:09:04 -04:00
|
|
|
def entity
|
|
|
|
@entity ||= tracker.entity
|
|
|
|
end
|
|
|
|
|
2021-02-02 13:09:42 -05:00
|
|
|
def group
|
2021-03-18 11:09:04 -04:00
|
|
|
@group ||= entity.group
|
|
|
|
end
|
|
|
|
|
|
|
|
def bulk_import
|
|
|
|
@bulk_import ||= entity.bulk_import
|
2021-02-02 13:09:42 -05:00
|
|
|
end
|
2020-10-23 11:08:42 -04:00
|
|
|
|
2021-02-02 13:09:42 -05:00
|
|
|
def current_user
|
2021-03-18 11:09:04 -04:00
|
|
|
@current_user ||= bulk_import.user
|
2020-10-23 11:08:42 -04:00
|
|
|
end
|
|
|
|
|
2021-02-02 13:09:42 -05:00
|
|
|
def configuration
|
2021-03-18 11:09:04 -04:00
|
|
|
@configuration ||= bulk_import.configuration
|
2020-10-23 11:08:42 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|