Sha256: 87fc7e5e97271c80291db4aaa46fe7a5fc052f40cc86ceed72746c12c1e52565

Contents?: true

Size: 581 Bytes

Versions: 6

Compression:

Stored size: 581 Bytes

Contents

class Topographer::Importer::Mapper::DefaultFieldMapping < Topographer::Importer::Mapper::FieldMapping

  def initialize(output_column, &output_block)
    unless block_given?
      raise Topographer::InvalidMappingError, 'Static fields must have an output block'
    end
    @output_field = output_column
    @output_block = output_block
  end

  def process_input(_, result)
    @output_data = @output_block.()
    result.add_data(@output_field, @output_data)
  rescue => exception
    result.add_error(@output_field, exception.message)
  end

  def required?
    true
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
topographer-0.0.7 lib/topographer/importer/mapper/default_field_mapping.rb
topographer-0.0.6 lib/topographer/importer/mapper/default_field_mapping.rb
topographer-0.0.5 lib/topographer/importer/mapper/default_field_mapping.rb
topographer-0.0.4 lib/topographer/importer/mapper/default_field_mapping.rb
topographer-0.0.3 lib/Topographer/importer/mapper/default_field_mapping.rb
topographer-0.0.2 lib/Topographer/importer/mapper/default_field_mapping.rb