Class: Hasta::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/hasta/mapper.rb

Overview

A wrapper for instantiating a mapper from a definition file and invoking it

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mapper_file) ⇒ Mapper

Returns a new instance of Mapper.



12
13
14
# File 'lib/hasta/mapper.rb', line 12

def initialize(mapper_file)
  @mapper_file = mapper_file
end

Instance Attribute Details

#mapper_fileObject (readonly)

Returns the value of attribute mapper_file.



10
11
12
# File 'lib/hasta/mapper.rb', line 10

def mapper_file
  @mapper_file
end

Instance Method Details

#map(execution_context, data_sources, data_sink = InMemoryDataSink.new('Mapper Output')) ⇒ Object



16
17
18
19
20
21
# File 'lib/hasta/mapper.rb', line 16

def map(execution_context, data_sources, data_sink = InMemoryDataSink.new('Mapper Output'))
  Hasta.logger.debug "Starting mapper: #{mapper_file}"

  data_source = CombinedDataSource.new(data_sources)
  execution_context.execute(mapper_file, data_source, data_sink)
end