Class: Topographer::Importer::Strategy::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/topographer/importer/strategy/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mapper) ⇒ Base

Returns a new instance of Base.



6
7
8
9
# File 'lib/topographer/importer/strategy/base.rb', line 6

def initialize(mapper)
  @mapper = mapper
  @dry_run = false
end

Instance Attribute Details

#dry_runObject

Returns the value of attribute dry_run.



4
5
6
# File 'lib/topographer/importer/strategy/base.rb', line 4

def dry_run
  @dry_run
end

#mapperObject (readonly)

Returns the value of attribute mapper.



3
4
5
# File 'lib/topographer/importer/strategy/base.rb', line 3

def mapper
  @mapper
end

Instance Method Details

#failure_messageObject



19
20
21
# File 'lib/topographer/importer/strategy/base.rb', line 19

def failure_message
  'Unable to import'
end

#import_record(record_input) ⇒ Object

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/topographer/importer/strategy/base.rb', line 11

def import_record (record_input)
  raise NotImplementedError
end

#should_persist_import?(status) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/topographer/importer/strategy/base.rb', line 23

def should_persist_import?(status)
  (@dry_run || status.errors?) ? false : true
end

#success_messageObject



15
16
17
# File 'lib/topographer/importer/strategy/base.rb', line 15

def success_message
  'Imported'
end