Class: ImportExport::TopicExporter

Inherits:
BaseExporter show all
Defined in:
lib/import_export/topic_exporter.rb

Constant Summary

Constants inherited from BaseExporter

BaseExporter::CATEGORY_ATTRS, BaseExporter::GROUP_ATTRS, BaseExporter::POST_ATTRS, BaseExporter::TOPIC_ATTRS, BaseExporter::USER_ATTRS

Instance Attribute Summary

Attributes inherited from BaseExporter

#categories, #export_data

Instance Method Summary collapse

Methods inherited from BaseExporter

#export_categories, #export_categories!, #export_category_groups, #export_category_groups!, #export_group_users, #export_group_users!, #export_groups, #export_groups!, #export_topic_users, #export_topic_users!, #export_topics, #export_topics!, #export_translation_overrides, #export_users, #save_to_file

Constructor Details

#initialize(topic_ids) ⇒ TopicExporter

Returns a new instance of TopicExporter.



7
8
9
10
# File 'lib/import_export/topic_exporter.rb', line 7

def initialize(topic_ids)
  @topics = Topic.where(id: topic_ids).to_a
  @export_data = { topics: [], users: [] }
end

Instance Method Details

#default_filename_prefixObject



20
21
22
# File 'lib/import_export/topic_exporter.rb', line 20

def default_filename_prefix
  "topic-export"
end

#performObject



12
13
14
15
16
17
18
# File 'lib/import_export/topic_exporter.rb', line 12

def perform
  export_topics!
  export_topic_users!
  # TODO: user actions

  self
end