Class: SpatialFeatures::Importers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/spatial_features/importers/base.rb

Direct Known Subclasses

GeoJSON, KML, Shapefile

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, make_valid: false, tmpdir: nil) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
# File 'lib/spatial_features/importers/base.rb', line 8

def initialize(data, make_valid: false, tmpdir: nil)
  @make_valid = make_valid
  @data = data
  @errors = []
  @tmpdir = tmpdir
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



6
7
8
# File 'lib/spatial_features/importers/base.rb', line 6

def errors
  @errors
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



25
26
27
# File 'lib/spatial_features/importers/base.rb', line 25

def self.create_all(data, **options)
  [new(data, **options)]
end

Instance Method Details

#cache_keyObject



19
20
21
# File 'lib/spatial_features/importers/base.rb', line 19

def cache_key
  @cache_key ||= Digest::MD5.hexdigest(@data)
end

#featuresObject



15
16
17
# File 'lib/spatial_features/importers/base.rb', line 15

def features
  @features ||= build_features
end