Class: CDMDEXER::FieldMapping

Inherits:
Object
  • Object
show all
Defined in:
lib/cdmdexer/field_mapping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: {}) ⇒ FieldMapping

Returns a new instance of FieldMapping.



4
5
6
# File 'lib/cdmdexer/field_mapping.rb', line 4

def initialize(config: {})
  @config = symbolize(config)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/cdmdexer/field_mapping.rb', line 3

def config
  @config
end

Instance Method Details

#dest_pathObject



12
13
14
# File 'lib/cdmdexer/field_mapping.rb', line 12

def dest_path
  config.fetch(:dest_path)
end

#formattersObject



16
17
18
19
20
# File 'lib/cdmdexer/field_mapping.rb', line 16

def formatters
  config.fetch(:formatters, [DefaultFormatter]).map do |formatter|
    formatter.is_a?(String) ? Object.const_get(formatter) : formatter
  end
end

#origin_pathObject



8
9
10
# File 'lib/cdmdexer/field_mapping.rb', line 8

def origin_path
  config.fetch(:origin_path)
end