Class: ImportExport::GroupExporter

Inherits:
BaseExporter show all
Defined in:
lib/import_export/group_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(include_group_users = false) ⇒ GroupExporter

Returns a new instance of GroupExporter.



5
6
7
8
9
10
# File 'lib/import_export/group_exporter.rb', line 5

def initialize(include_group_users = false)
  @include_group_users = include_group_users

  @export_data = { groups: [] }
  @export_data[:users] = [] if @include_group_users
end

Instance Method Details

#default_filename_prefixObject



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

def default_filename_prefix
  "groups-export"
end

#performObject



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

def perform
  puts "Exporting all user groups...", ""
  export_groups!
  export_group_users! if @include_group_users

  self
end