Class: Decidim::Importers::ImportManifest
- Inherits:
-
Object
- Object
- Decidim::Importers::ImportManifest
- Defined in:
- lib/decidim/importers/import_manifest.rb
Overview
For importing data from files to components. Every resource type should specify it’s own creator, which will be responsible for producing (creating) and finishing (saving) the imported resource.
Constant Summary collapse
- DEFAULT_FORMATS =
%w(CSV JSON Excel).freeze
Instance Attribute Summary collapse
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#creator(creator = nil) ⇒ Object
Public: Sets the creator when an argument is provided, returns the stored creator otherwise.
- #formats ⇒ Object
-
#initialize(name, manifest) ⇒ ImportManifest
constructor
Initializes the manifest.
Constructor Details
#initialize(name, manifest) ⇒ ImportManifest
Initializes the manifest.
name - The name of the export artifact. It should be unique in the
space or component.
manifest - The parent manifest where this import manifest belongs to.
18 19 20 21 |
# File 'lib/decidim/importers/import_manifest.rb', line 18 def initialize(name, manifest) @name = name.to_sym @manifest = manifest end |
Instance Attribute Details
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
9 10 11 |
# File 'lib/decidim/importers/import_manifest.rb', line 9 def manifest @manifest end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/decidim/importers/import_manifest.rb', line 9 def name @name end |
Instance Method Details
#creator(creator = nil) ⇒ Object
Public: Sets the creator when an argument is provided, returns the stored creator otherwise.
25 26 27 |
# File 'lib/decidim/importers/import_manifest.rb', line 25 def creator(creator = nil) @creator ||= creator || Decidim::Admin::Import::Creator end |
#formats ⇒ Object
31 32 33 |
# File 'lib/decidim/importers/import_manifest.rb', line 31 def formats DEFAULT_FORMATS end |