Class: CmAdmin::Models::Importer

Inherits:
Object
  • Object
show all
Defined in:
lib/cm_admin/models/importer.rb

Constant Summary collapse

VALID_IMPORTER_TYPES =
[:csv_importer, :custom_importer]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(class_name, importer_type = :csv_importer) ⇒ Importer

Returns a new instance of Importer.

Raises:

  • (ArgumentError)


9
10
11
12
13
# File 'lib/cm_admin/models/importer.rb', line 9

def initialize(class_name, importer_type=:csv_importer)
  raise ArgumentError, "Kindly select a valid importer type like #{VALID_IMPORTER_TYPES.sort.to_sentence(last_word_connector: ', or ')} instead of #{importer_type}" unless VALID_IMPORTER_TYPES.include?(importer_type.to_sym)
  @class_name = class_name
  @importer_type = importer_type
end

Instance Attribute Details

#class_nameObject

Returns the value of attribute class_name.



5
6
7
# File 'lib/cm_admin/models/importer.rb', line 5

def class_name
  @class_name
end

#importer_typeObject

Returns the value of attribute importer_type.



5
6
7
# File 'lib/cm_admin/models/importer.rb', line 5

def importer_type
  @importer_type
end