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.
Class Method Summary collapse
-
.create_all(data, **options) ⇒ Object
factory method that should always be used instead of ‘new` when 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.
9 10 11 12 13 14 15 16 |
# File 'lib/spatial_features/importers/base.rb', line 9 def initialize(data, make_valid: false, tmpdir: nil, source_identifier: nil, feature_name: ->(record) { record.name }) @make_valid = make_valid @data = data @errors = [] @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.
7 8 9 |
# File 'lib/spatial_features/importers/base.rb', line 7 def source_identifier @source_identifier 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
28 29 30 |
# File 'lib/spatial_features/importers/base.rb', line 28 def self.create_all(data, **) [new(data, **)] end |
Instance Method Details
#cache_key ⇒ Object
22 23 24 |
# File 'lib/spatial_features/importers/base.rb', line 22 def cache_key @cache_key ||= Digest::MD5.hexdigest(@data) end |
#features ⇒ Object
18 19 20 |
# File 'lib/spatial_features/importers/base.rb', line 18 def features @features ||= build_features end |