Class: Importo::BaseImporter

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::SanitizeHelper, ActiveSupport::Callbacks, Exportable, Importable, ImporterDsl, Original, ResultFeedback, Revertable
Defined in:
app/importers/importo/base_importer.rb

Direct Known Subclasses

ApplicationImporter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ResultFeedback

#file_name, #results_file

Methods included from Original

#col_for, #invalid_header_names, #original, #structure_valid?

Methods included from Revertable

#revert!

Methods included from Exportable

#export, #export_columns, #export_data, #export_file, #export_row, #export_scope, #sample_data, #sample_file

Methods included from Importable

#after_build, #after_save, #after_validate, #around_build, #around_save, #around_validate, #before_build, #before_save, #before_validate, #build, #convert_values, #import!, #populate, #process_data_row

Constructor Details

#initialize(imprt = nil) ⇒ BaseImporter

Returns a new instance of BaseImporter.



26
27
28
29
# File 'app/importers/importo/base_importer.rb', line 26

def initialize(imprt = nil)
  @import = imprt
  I18n.locale = import.locale if import&.locale # Should we do this?? here??
end

Instance Attribute Details

#blobObject (readonly)

Returns the value of attribute blob.



24
25
26
# File 'app/importers/importo/base_importer.rb', line 24

def blob
  @blob
end

#importObject (readonly)

Returns the value of attribute import.



24
25
26
# File 'app/importers/importo/base_importer.rb', line 24

def import
  @import
end

Class Method Details

.t(key, options = {}) ⇒ Object



37
38
39
40
41
# File 'app/importers/importo/base_importer.rb', line 37

def t(key, options = {})
  if I18n.exists? :"importers.#{name.underscore}#{key}"
    I18n.t(key, options.merge(scope: :"importers.#{name.underscore}"))
  end
end

Instance Method Details

#state_changed(_import, transition) ⇒ Object



31
32
33
34
# File 'app/importers/importo/base_importer.rb', line 31

def state_changed(_import, transition)
  run_callbacks(transition.to_name) do
  end
end