Module: Tramway::Export

Defined in:
lib/tramway/export.rb,
lib/tramway/export/engine.rb,
lib/tramway/export/version.rb,
app/jobs/tramway/export/application_job.rb,
app/models/tramway/export/application_record.rb,
app/helpers/tramway/export/application_helper.rb,
app/mailers/tramway/export/application_mailer.rb,
app/decorators/tramway/export/xls/application_decorator.rb

Defined Under Namespace

Modules: ApplicationHelper, Xls Classes: ApplicationDecorator, ApplicationJob, ApplicationMailer, ApplicationRecord, Engine, ExportsController

Constant Summary collapse

VERSION =
'0.2.1.3'

Class Method Summary collapse

Class Method Details

.exportable_model?(model_class, project:) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
# File 'lib/tramway/export.rb', line 18

def exportable_model?(model_class, project:)
  return false unless project.present?

  @exportable_models[project.to_sym]&.map(&:to_s)&.include?(model_class.to_s) ||
    @exportable_models[project.to_sym]&.map { |config| config.is_a?(Hash) && config.keys.first.to_s == model_class.to_s }&.include?(true)
end

.exportable_models(project:) ⇒ Object



14
15
16
# File 'lib/tramway/export.rb', line 14

def exportable_models(project:)
  @exportable_models[project.to_sym]
end

.set_exportable_models(*models, project:) ⇒ Object



8
9
10
11
12
# File 'lib/tramway/export.rb', line 8

def set_exportable_models(*models, project:)
  @exportable_models ||= {}
  @exportable_models[project.to_sym] ||= []
  @exportable_models[project.to_sym] += models
end