Class: SpatialFeatures::Importers::Base
- Inherits:
-
Object
- Object
- SpatialFeatures::Importers::Base
- Defined in:
- lib/spatial_features/importers/base.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#source_identifier ⇒ Object
An identifier for the source of the features.
-
#warnings ⇒ Object
readonly
Non-fatal messages about parts of the source that could not be imported but did not prevent the remaining features from importing (e.g. unsupported elements).
Class Method Summary collapse
-
.create_all(data, **options) ⇒ Object
factory method that should always be used instead of
newwhen creating importers returns an array of Importer::* objects.
Instance Method Summary collapse
- #cache_key ⇒ Object
- #features ⇒ Object
-
#initialize(data, make_valid: false, tmpdir: nil, source_identifier: nil, feature_name: ->(record) { record.name }) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(data, make_valid: false, tmpdir: nil, source_identifier: nil, feature_name: ->(record) { record.name }) ⇒ Base
Returns a new instance of Base.
15 16 17 18 19 20 21 22 23 |
# File 'lib/spatial_features/importers/base.rb', line 15 def initialize(data, make_valid: false, tmpdir: nil, source_identifier: nil, feature_name: ->(record) { record.name }) @make_valid = make_valid @data = data @errors = [] @warnings = [] @tmpdir = tmpdir @source_identifier = source_identifier @feature_name = feature_name end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
6 7 8 |
# File 'lib/spatial_features/importers/base.rb', line 6 def errors @errors end |
#source_identifier ⇒ Object
An identifier for the source of the features. Used to differentiate groups of features on the spatial model.
13 14 15 |
# File 'lib/spatial_features/importers/base.rb', line 13 def source_identifier @source_identifier end |
#warnings ⇒ Object (readonly)
Non-fatal messages about parts of the source that could not be imported but
did not prevent the remaining features from importing (e.g. unsupported
elements). Unlike errors, warnings never abort the import.
11 12 13 |
# File 'lib/spatial_features/importers/base.rb', line 11 def warnings @warnings end |
Class Method Details
.create_all(data, **options) ⇒ Object
factory method that should always be used instead of new when creating importers
returns an array of Importer::* objects
35 36 37 |
# File 'lib/spatial_features/importers/base.rb', line 35 def self.create_all(data, **) [new(data, **)] end |
Instance Method Details
#cache_key ⇒ Object
29 30 31 |
# File 'lib/spatial_features/importers/base.rb', line 29 def cache_key @cache_key ||= Digest::MD5.hexdigest(@data) end |
#features ⇒ Object
25 26 27 |
# File 'lib/spatial_features/importers/base.rb', line 25 def features @features ||= build_features end |