Class: CDMDEXER::FieldMapping
- Inherits:
-
Object
- Object
- CDMDEXER::FieldMapping
- Defined in:
- lib/cdmdexer/field_mapping.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #dest_path ⇒ Object
- #formatters ⇒ Object
-
#initialize(config: {}) ⇒ FieldMapping
constructor
A new instance of FieldMapping.
- #origin_path ⇒ Object
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
#config ⇒ Object (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_path ⇒ Object
12 13 14 |
# File 'lib/cdmdexer/field_mapping.rb', line 12 def dest_path config.fetch(:dest_path) end |
#formatters ⇒ Object
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_path ⇒ Object
8 9 10 |
# File 'lib/cdmdexer/field_mapping.rb', line 8 def origin_path config.fetch(:origin_path) end |